[null, {"document_url": "http://helloraspberrypi.blogspot.com/2014/12/raspberry-pi-send-block-of-data-to.html", "unformatted_src": "http://4.bp.blogspot.com/-jIW6lGHsm-8/VI549GYjjXI/AAAAAAAAL50/h-3mncyUuoU/s1600/RPI_Uno_i2c_bb.png", "src": "http://4.bp.blogspot.com/-jIW6lGHsm-8/VI549GYjjXI/AAAAAAAAL50/h-3mncyUuoU/s1600/RPI_Uno_i2c_bb.png", "formatted_filename": "RPI Uno i c bb", "rendered_width": 400, "rendered_height": 392}, null, null, null, {"document_url": "http://helloraspberrypi.blogspot.com/2014/12/raspberry-pi-send-block-of-data-to.html", "unformatted_src": "http://1.bp.blogspot.com/-dQuJKdvyaRM/VSx4Hj7giuI/AAAAAAAANFY/Vfc6uHtMjoY/s1600/Creative1-320X50.jpg", "src": "http://1.bp.blogspot.com/-dQuJKdvyaRM/VSx4Hj7giuI/AAAAAAAANFY/Vfc6uHtMjoY/s1600/Creative1-320X50.jpg", "formatted_filename": "Creative X", "alt_text": "Make money from your site", "rendered_width": 320, "rendered_height": 50}, null, null, null]

Raspberry Pi send block of data to Arduino using I2C

In this example, Raspberry Pi programmed using Python with smbus library, act as I2C master, ask user enter something as string, then send to Arduino Uno in blocks of data. In Arduino side, act as I2C slave, interpret received data in number of bytes, command, and body of data, to display on 16x2 LCD display.

Prepare on Raspberry Pi for I2C communication, refer to previous post "Communication between Raspberry Pi and Arduino via I2C, using Python".

Connection between Raspberry Pi, Arduino Uno and 16x2 LCD: i2c_slave_12x6LCD.ino sketch run on Arduino Uno.

i2c_uno.py, python program run on Raspberry Pi.

- Raspberry Pi + Arduino i2c communication, write block and read byte

Somebody advise to use I2C Logic Level Converter between Raspberry Pi and Arduino, otherwise the RPi's ports will be burnt! So, please think about it and take your own risk.

by： Andr.oid Eric at: 10:06 PM label： Arduino, example code.Arduino, example code.Python, i2c

