This project is about learning how to interface the R-Pi to the real world, mainly various I2C devices.
A quick go at talking to a few devices
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
This project is about learning how to interface the R-Pi to the real world, mainly various I2C devices.
2020-12-13
I had several non-pi boards on a bread board. Connected them to the Pi with coloured wires.
Opening a console to run from the command line,
i2cdetect -y 1
detected devices at hex addresses 20 (MCP23017 sixteen-bit PIO), 48 ( ADS1115 ADC), 57 (DS3232 Real-Time Clock) and 68 (MPU6050 accelerometer/gyro).
2020-12-14
Example Python code from https://www.abelectronics.co.uk/kb/article/1094/i2c-part-4---programming-i-c-with-python now talking to the MCP23017 i/o board, blinking a light and reading inputs.
DS3231 real-time clock now successfully integrated into the OS.
2020-12-12
Bought this from The Pi Shop for £46. Includes a touch-screen digitiser.
Installed the software, rebooted, and it got stuck at the square splash screen.
The LCD backlight is on, so it is getting power on the right pins.
Recovered by editing the config.txt file display-control entries after the [all] line.
This doesn't solve the installation problem, but I will leave that for later.
2020-12-12
Bought this from the Pi Shop for £25.
https://thepihut.com/products/inky-phat
This might be useful in battery-powered equipment, to show data like when a battery was last fitted, and how much estimated battery life is left. This will remain on the screen even after a battery has died. There are situations where a dead battery can result in a dead user!
The box has a link to http://pimoroni.com/inkyphat, which links to installation instructions at https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-inky-phat
The software can be installed by the command line
curl https://get.pimoroni.com/inkyphat | bash
This collects the script from the web url and pipes it to the bash command.
It is a very long script, and several times reported:
"Some packages could not be installed, review the output for details!"
I ran the demos anyway, seemed to work fine.
Total installation time very short, mostly installation script working.
Key points:
2020-12-12
Bought this from the Pi Shop in town, for £25.
This might be useful for remotely monitoring events, either in real time.
It is rated 1080 lines at 30 fps, and 720 at 60 fps, which should be plenty.
The PiCamera box has a link to https://www.okdo.com/gettingstarted/, which links to the product page at https://www.okdo.com/p/official-raspberry-pi-camera-v2-1/, which links to how to use it https://www.raspberrypi.org/documentation/usage/camera/.
Key points:
Instructions advise updating and upgrading the software first, using the command line:
sudo apt-get update && sudo apt-get upgrade
This took about 22 minutes.
After that, I rebooted and was able to run the commands to demonstrate it was working.
Total installation time is a few minutes, discounting the software update. I made the mistake of plugging it into the LCD port. Thankfully this hasn't damaged the camera.
2020-10-27 Ordered modules to play with:
That should be enough to get on with. The level shifter is for interfacing to 5V devices.
2020-10-27 Setting up R-Pi with fresh installation of Raspbian on Micro-SD card.
Had some issues with this. Installed Raspbian and Kodi from the NOOBS card. After updating itself, Raspbian fails to boot, producing repetitive 4-flash sequence on green LED, indicating it cannot find the loader program. I used the Windows Raspbian disk-image creator, which produced an SD card that booted reliably.
Second issue is that my display (Dell) goes blank every few seconds. Google results suggest this is due to inadequate earthing of the monitor. It looks fine to me. Other results suggest changing the HDMI drive boost settings of the Pi.
I guessed that the USB PSU could not supply enough current, and thus the Pi failed while re-writing the card. I have replaced it with a bigger PSU. Swapped displays - my LG 2753EV does not blank.
2020-11-02 Set Locale Country and Keyboard to GB.
In Settings-->Configuration-->Interfaces tab, enable I2C and SPI.
Run Thonny IDE interface for Python. Ran the example program LED.py and this seemed to work.
Opening a console to run from the command line,
i2cdetect -y 1
returns a scan of devices like so:
0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
All seems ready to proceed. I2C devices cannot be plugged in while the Pi is running, so they must be connected to a bit of breadboard and connected first.
Looked around for existing software for the devices I bought. No point reinventing wheels! The manufacturers provide documentation and sometimes Pi Python code examples.
2020-11-03
Quick check of expected addresses, in case of conflicts. None apparent.
Addresses from https://learn.adafruit.com/i2c-addresses/the-list
010 0xxx = 2x = MCP23017 011 110x = 3C = SSD1306 100 10xx = 48 = ADS1115 110 0xxx = 60 = MCP4725 110 100x = 68 = MPU6050
2020-11-12
Googled for further information, there is plenty at Adafruit:
https://learn.adafruit.com/search?q=MCP23017
https://learn.adafruit.com/search?q=ADS1x15
https://learn.adafruit.com/search?q=SSD1306
https://learn.adafruit.com/search?q=MCP4725
https://learn.adafruit.com/search?q=MPU-6050
At this point there is not much I can add to this project that is not already on the web.
Create an account to leave a comment. Already have an account? Log In.
Become a member to follow this project and never miss any updates
By using our website and services, you expressly agree to the placement of our performance, functionality, and advertising cookies. Learn More