CircuitPython Driver for Adafruit 24LC32 I2C EEPROM Breakout 32Kbit / 4 KB

Overview

Introduction

Documentation Status Discord Build Status Code Style: Black

CircuitPython driver for Adafruit 24LC32 I2C EEPROM Breakout

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.

Adafruit 24LC32 I2C EEPROM Breakout

Purchase one from the Adafruit shop

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install adafruit-circuitpython-24lc32

To install system-wide (this may be required in some cases):

sudo pip3 install adafruit-circuitpython-24lc32

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install adafruit-circuitpython-24lc32

Installing to a Connected CircuitPython Device with Circup

Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:

pip3 install circup

With circup installed and your CircuitPython device connected use the following command to install:

circup install adafruit_24lc32

Or the following command to update an existing version:

circup update

Usage Example

import board
import adafruit_eeprom

i2c = board.I2C()
eeprom = adafruit_eeprom.EEPROM_I2C(i2c)

print("length: {}".format(len(eeprom)))

eeprom[0] = 4
print(eeprom[0])

while True:
    pass

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Documentation

For information on building library documentation, please check out this guide.

Comments
  • Scan does, driver doesn't find chip

    Scan does, driver doesn't find chip

    I have a custom build Adafruit CircuitPython 7.3.0-alpha.0-38-g862210b3f-dirty on 2022-03-13; Adafruit Trinket M0 with samd21e18 with 24lc32 frozen.

    I can find the chip via I2C scan at the address 0x50 but the driver doesn't find it there.

    import board
    import time
    import adafruit_24lc32
    import supervisor
    
    supervisor.disable_autoreload()
    
    i2c = board.I2C()
    
    #  scan I2C
    while not i2c.try_lock():
        pass
    try:
        while True:
            print(
                "I2C addresses found:",
                [hex(device_address) for device_address in i2c.scan()],
            )
            time.sleep(1)
    finally:  # unlock the i2c bus when ctrl-c'ing out of the loop
        i2c.unlock()
    
    #  setup for EEPROM
    eeprom = adafruit_24lc32.EEPROM_I2C(i2c_bus=i2c)
    
    

    I2C addresses found: ['0x50']

    
    Traceback (most recent call last):
      File "code.py", line 24, in <module>
      File "adafruit_24lc32.py", line 240, in __init__
    ValueError: No I2C device at address: 0x50
    
    
    opened by muranyia 15
  • Add function to change EEPROM size

    Add function to change EEPROM size

    Please add something like this to the library about Line 250.

    `

    Added by Bruce Blake

    def EEPROM_size(self, size):
    
        self._max_size = size
    
        return(self._max_size)
    

    ` Why? Gives the user the opportunity to use this library with larger EEPROMS. Scanning the EEPROM to determine it's size is an option too.

    opened by b-blake 4
  • Update ValueError raised when storing non-integer in index

    Update ValueError raised when storing non-integer in index

    This fixes the issue mentioned the equivalent issue mentioned here in the FRAM library:

    Also, updates example to use correct indexes as fixed with PR #1

    opened by tekktrik 4
  • import in code example in documentation is wrong

    import in code example in documentation is wrong

    In the online docs this part of the code doesn't work:

    import adafruit_eeprom
    
    i2c = board.I2C()
    eeprom = adafruit_eeprom.EEPROM_I2C(i2c)
    

    changing it like this makes it work:

    import adafruit_24lc32
    
    i2c = board.I2C()
    eeprom = adafruit_24lc32.EEPROM_I2C(i2c)
    

    (If documentation bugs are to be submitted elsewhere, please advise me. Thanks.)

    opened by muranyia 3
  • RTD build documentation not working

    RTD build documentation not working

    Not sure what's up, but the badge on the repo doesn't bring you to documentation but instead a 404 screen. Looking into it now, but wanted to file a general issue in case anyone gets to it first.

    opened by tekktrik 2
  • Feature request: extend the library to support 01/02/04/08/16 parts

    Feature request: extend the library to support 01/02/04/08/16 parts

    It would be great if this library could also support smaller eeprom chips.

    The main difference for those is in addressing, 04 parts borrow one bit from the slave address for the memory address (9 bits to address 500 bytes), 08 parts borrow 2 and 16 parts borrow three.

    image

    Following the slave address, only one byte is used for the rest of the address.

    image

    opened by fijam 1
  • Add typing and other tweaks

    Add typing and other tweaks

    1. Adds type annotations like other libraries are getting
    2. Changes a few instances of checking whether value is True OR False to isinstance() which is more Pythonic. Happy to revert if this was done for a specific reason
    3. Updates Sphinx formatting in docstrings so things are clearer, or will display properly based on the hardships I've had with Sphinx haha. Can't confirm they help (or that anything was actually wrong yet) since documentation isn't viewable yet.
    opened by tekktrik 1
  • update docstrings. comment writes in simpletest

    update docstrings. comment writes in simpletest

    resolves #5

    Updated all references to FRAM to EEPROM tested with get grep fram and git grep FRAM

    Also comment out the write statements in simpletest so users will not unknowingly wear their device with extra writes.

    opened by FoamyGuy 0
  • A lot of reference to FRAM in docstring but also code.

    A lot of reference to FRAM in docstring but also code.

    It seems that the cleaning from FRAM to EEPROM could continue a little bit: ´´´ if self.write_protected: raise RuntimeError("FRAM currently write protected.") ´´´

    But many other in the comment/doc.

    opened by dglaude 0
  • Stores wrong value for 9, 10, 13

    Stores wrong value for 9, 10, 13

    For some reason the library is converting the 9, 10, 13 to TAB, NEW_LINE, CARRAGE_RETURN and storing the "" character, 0x53, into the EEPROM.

    eeprom[0x10] = 9 print(eeprom[0x10]) eeprom[0x10:0x16] = [9, 10, 13, 3, 8, 1] print(eeprom[0x10:0x18])

    EEPROM Dump: 0x0010 | 0x5C 0x03 0x08 0x01 0xFF 0xFF 0xFF 0xFF

    The output shows: bytearray(b'\t') bytearray(b'\t\n\r\x03\x08\x01\xff\xff')

    How do I get an output "stuff=eeprom(0x10:0x18)" other than in a bytearray?

    Bruce

    opened by b-blake 4
  • Using this library for Adafruit ST25DV16K I2C RFID EEPROM Breakout

    Using this library for Adafruit ST25DV16K I2C RFID EEPROM Breakout

    I have been able to use a modified version of this library and demo code to read the EEPROM content of ST25DV16K.

    Maybe a more generalized version of EEPROM reading where the size and I2C address can be changed would be more usefull.

    So here are the change I made are : _MAX_SIZE_I2C = const(0x800) # 16kbits and def __init__(self, i2c_bus, address=0x53, write_protect=False, wp_pin=None):

    I have used the following code:

    import board
    import adafruit_st25dv16
    
    i2c = board.I2C()
    eeprom = adafruit_st25dv16.EEPROM_I2C(i2c)
    
    print("length: {}".format(len(eeprom)))
    
    for i in range(0, 4):
        j = i * 16
        hex_string = ":".join("%02x" % b for b in eeprom[j:j+15])
        print(j, "> ", hex_string, "> ", eeprom[j:j+15])
    

    The result is a dump:

    0 >  e1:40:40:05:03:10:d1:01:0c:55:01:73:74:2e:63:6f >  bytearray(b'\xe1@@\x05\x03\x10\xd1\x01\x0cU\x01st.co')
    16 >  6d:2f:73:74:32:35:fe:2f:70:72:6f:64:75:63:74:2f >  bytearray(b'm/st25\xfe/product/')
    32 >  34:37:30:31:fe:00:00:00:00:00:00:00:00:00:00:00 >  bytearray(b'4701\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
    48 >  00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 >  bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
    

    We can clearly see the URL written by ST arduino demo code: "st.com/st25" (Hello World exemple from https://github.com/stm32duino/ST25DV )

    And part of the URL maybe set by Adafruit in factory: "/product/4701"

    So with a bit of code that properly structure the NFC TAG value in the EEPROM it should be possible to use the ST25DV16K from CircuitPython for basic usage of setting the value of the tag.

    opened by dglaude 2
Releases(1.0.8)
Owner
Adafruit Industries
Adafruit Industries
Something like Asteroids but not really, done in CircuitPython

CircuitPython Staroids Something like Asteroids, done in CircuitPython. Works with FunHouse, MacroPad, Pybadge, EdgeBadge, CLUE, and Pygamer. circuitp

Tod E. Kurt 14 May 31, 2022
Do you need a screensaver for CircuitPython? Of course you do

circuitpython_screensaver Do you need a screensaver for CircuitPython? Of course you do Demo video of dvdlogo screensaver: screensaver_dvdlogo.mp4 Dem

Tod E. Kurt 8 Sep 2, 2021
XAC HID Gamepad implementation for CircuitPython 7 or above.

CircuitPython_XAC_Gamepad Setup process Install CircuitPython 7 or above in your board. Add the init.py file under \lib\adafruit_hid directory of CIRC

null 5 Dec 19, 2022
VirtualBox Power Driver for MAAS (Metal as a Service)

vboxpower VirtualBox Power Driver for MAAS (Metal as a Service) A way to manage the power of VirtualBox virtual machines via the MAAS webhook driver.

Saeid Bostandoust 131 Dec 17, 2022
CircuitPython Driver for Adafruit 24LC32 I2C EEPROM Breakout 32Kbit / 4 KB

Introduction CircuitPython driver for Adafruit 24LC32 I2C EEPROM Breakout Dependencies This driver depends on: Adafruit CircuitPython Bus Device Regis

Adafruit Industries 4 Oct 3, 2022
A ch341dll Wrap is for using in Python 32bits windows to access I2C SPI and MDIO (by GPIO), and Demo with display PC sreen on OLED by i2c or SPI .

ch341dll_wrap_typcal_app A ch341dll Wrap is for using in Python 32bits windows to access I2C SPI and MDIO (by GPIO). In addition, I provided 3 Demo. I

null 13 Jan 2, 2023
SPI driven CircuitPython driver for PCA9745B constant current LED driver.

Introduction THIS IS VERY MUCH ALPHA AND IN ACTIVE DEVELOPMENT. THINGS WILL BREAK! THIS MAY ALSO BREAK YOUR THINGS! SPI driven CircuitPython driver fo

Andrew Ferguson 1 Jan 14, 2022
Adafruit IO connected smart thermostat based on CircuitPython.

Adafruit IO Thermostat Adafruit IO connected smart thermostat based on CircuitPython. Background and Motivation I have a 24 V Heat-only system with a

Shubham Chaudhary 1 Jan 18, 2022
A Discord bot that enables using breakout rooms on a server

Discord Breakout Room Bot This bot enables you to use breakout rooms on your Discord server! Note This bot was thrown together within a few hours, so

Till Müller 2 Nov 23, 2021
Python application, displaying currently played track from Spotify on OLED display connected via I2C

RaspberryPi Spotify OLED Display This application will display currently played track on SSD1306 OLED display connected to RaspberryPi. Displayed stuf

Wojciech Olech 2 Dec 30, 2021
Breakout-KD - A fantastic game created in python with pygame ✌️

Breakout-KD About This Game Breakout-KD is a fantastic breakout game. It's a python based game officialy made by me on december holiday. This game wor

Keep Distance 1 Jan 1, 2022
ROS Foxy + Raspi + Adafruit BNO055

ROS Foxy + Raspi + Adafruit BNO055

Ar-Ray 3 Nov 4, 2022
AdaFruit Funhouse publishing Temperature, Humidity and Pressure to MQTT / Apache Pulsar

pulsar-adafruit-funhouse AdaFruit Funhouse publishing Temperature, Humidity and Pressure to MQTT / Apache Pulsar Device Get your own from adafruit Ada

Timothy Spann 1 Dec 30, 2021
Wordle for CLUE - WORDLE clone for Adafruit Clue

Wordle_for_CLUE This project is a clone of the very popular word solving puzzle

Michael Lacock 4 Feb 15, 2022
Sleep Functionality for Adafruit MacroPad RP2040

Adafruit-MacroPad-RP2040 Sleep Functionality for Adafruit MacroPad RP2040 Details This is a modification of AdaFruit project bundle found here specifi

null 9 Dec 18, 2022
A Macropad using the Raspberry Pi Pico, programmed with CircuitPython.

A Macropad using the Raspberry Pi Pico, programmed with CircuitPython.

null 15 Oct 14, 2022
Raspberry Pi Pico and LoRaWAN from CircuitPython

Raspberry Pi Pico and LoRaWAN from CircuitPython Enable LoRaWAN communications on your Raspberry Pi Pico or any RP2040-based board using CircuitPython

Alasdair Allan 15 Oct 8, 2022
Something like Asteroids but not really, done in CircuitPython

CircuitPython Staroids Something like Asteroids, done in CircuitPython. Works with FunHouse, MacroPad, Pybadge, EdgeBadge, CLUE, and Pygamer. circuitp

Tod E. Kurt 14 May 31, 2022
Do you need a screensaver for CircuitPython? Of course you do

circuitpython_screensaver Do you need a screensaver for CircuitPython? Of course you do Demo video of dvdlogo screensaver: screensaver_dvdlogo.mp4 Dem

Tod E. Kurt 8 Sep 2, 2021
CircuitPython library for the CH559 USB to Serial chip

CH559 (USB to Serial) CircuitPython Library Why? Because you might want to get keyboard/mouse/gamepad/HID input into your CircuitPython projects witho

Guy Dupont 3 Nov 19, 2022