Work in Progress: Getting the RaspBerry Pi to talk to the Canopy


In my previous post I managed to program the chips in the Canopy. Now I can adjust the code inside the Canopy where needed. Next thing to get working is to allow the Raspberry Pi to talk to the chips inside the Canopy.



Raspberry Pi, Atmel AVR and serial communications

Luckily the Raspberry Pi has a serial port, because the AVR controllers I used have one too, and they use this serial port to get commands from whoever is controlling the bus… Which should be the Raspberry Pi.

Problem is that the Raspberry Pi does not have a true RS232 serial port: the signals are there (on the GPIO headers), but they have 0-3.3V levels and they are inverted form the RS232 signal. Luckily the serial transmissions the AVRs in the Canopy expect are also inverted, but on a TTL (0-5V) level. Just connecting them up together will break stuff… Or maybe not?


Building the simplest interface possible

I started out with 74HCT540 chips to buffer the signals and convert their levels… But in the end I basically just connected them together. Why doesn’t this break things? Simple:

  1. The signals transmitted by the Raspberry Pi are 0 and 3.3V, well within the allowed levels of the Atmel AVR controllers (0-5V). Also, the AVR consider anything above 0.6 volts to be a logical “one”, so 3.3V is more than sufficient.
  2. The signals received by the Raspberry Pi would normally damage the RPi, as the 5V logic “high” is way above the 3.3V it accepts as a maximum. But because I have multiple AVR controllers on a single bus, all chips have a diode that effectively pull the voltage down for a zero, but RELEASE the wire for a high. So I could just mount a single pullup resistor to the +3.3V of the RPi, and now I receive serial signals between 0 and 3.3V.

Problem solved! Now to build this “converter” in a way that it won’t break, AND fits into the RPi’s houseing. I think it worked out fine:

Raspberry Pi with my serial communication "level converter". It still fits in the RPi's housing, so I'm happy.

Raspberry Pi with my serial communication “level converter”. It still fits in the RPi’s housing, so I’m happy.

After connecting it all up, I mounted the RPi inside the Canopy. What a tiny little controller it is inside this big wooden box:

Let's play find the RPi. IT sits neatly between the LED light sources, just under the power supply.

Let’s play “find the RPi”! It sits neatly between the LED light sources, just under the power supply.

From here, it controls all 12 AVR controllers inside the Canopy. These controllers look like this:

AVR Controllers inside the Canopy. Note the grey cable looping through all controllers to form a shared serial bus.

AVR Controllers inside the Canopy. Note the grey cable looping through all controllers to form a shared serial bus.

So what does the entire Canopy look like now? Check it out!

The entire Canopy with lights burning (not at 100%). Well almost... I just noticed I burnt a halogen in the bottom left :S

The entire Canopy with lights burning (not at 100%). Well almost… I just noticed I burnt a halogen in the bottom left :S

2 Responses to Work in Progress: Getting the RaspBerry Pi to talk to the Canopy

  1. hello. is it possible to buy this Canopy ?

    • Hi,

      Unfortunately, no. There is SO much custom stuff in there, it is difficult to reproduce… It is really custom built. I have considered to build a simplified version using a Raspberry Pi and a single Arduino board… But that is a long way out still if ever. Sorry!

Leave a Reply

Your email address will not be published. Required fields are marked *

*