For many experimenters, the Raspberry-Pi will be their microcontroller of choice. It’s much more powerful than the Arduino and therefore allows for potentially more complicated projects.
For this tutorial I’ll concentrate on using Raspbian as the Pi’s operating system. In the following tutorial I’ll talk about using RISC OS instead … but the wiring info is identical.
Wiring to the Raspberry-Pi
The I2C bus is implemented on the Raspberry-Pi on the GPIO header, conveniently close to the +5v and 0v connections, like this:
So to connect a Raspberry-Pi to the Experimenter’s Board is simply a case of finding four DuPont connecting wires.
And that’s it!
Configuring Raspbian for I2C support
I2C support is activated by running
sudo raspi-config
then selecting
Interfacing Options -> I2C -> Yes
The change is immediate – you don’t need to reboot.
A useful thing to do now is to run a quick I2C scan, which will tell you what devices are connected to the I2C bus. To install the utility, enter this:
sudo apt-get install -y i2c-tools
And then to run it:
sudo i2cdetect -y 1
And if the Experimenter’s Board is detected, device 11 will appear in the table displayed … like this:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- 11 -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Code example
My example for this tutorial is a bit of C code that demonstrates sending data to the board. It loads a file of Teletext (the sort of file you’d get if you designed your page with edit.tf or zxnet’s editor) and transfers it over I2C.
Actually, it’s a proof-of-concept for another project of mine. I want to install the occasional screen around the house, showing the current time and date, mine and my wife’s diary entries over the next few days, the caller-ID for any incoming housecalls, and the temperature sensor readings from around the house.
Now, I’m almost certainly going to use Raspberry-Pis and HDMI screens for this … but I had this half-baked idea about going for a more retro-theme by displaying it Teletext-style instead! And this utility is how I’d get the aggregated info to the hardware. Which means this is probably my first real-world example for this project!
In a Raspbian command-window, or via a SSH client (such as PuTTY), enter these commands:
wget -q http://www.danceswithferrets.org/geekblog/wp-content/uploads/2020/06/sendttimage.tar.gz
tar xzf sendttimage.tar.gz
cd sendttimage
make
These commands download the archive from my website, unpack it, then compile the code.
To use the executable, simply provide a file:
./sendttimage test1.ttext
And you’ll see my diary-screen mockup!
Click here to visit the Teletext Experimenter’s Board main project page.