Over the last few days I've been working on a lot of small things, and I've had a lot of new interesting findings. This is a combined blogpost of all the new stuff I'm working on.
For one, I took apart my central pilight controller Raspberry (after a staggering uptime of 224 days!) and had it equipped with an upgraded version of the RS485 shield from my previous post
. I didn't take pictures this time, but the RS485 part is basically still the same. What I've done is I've added both I2C and SPI outputs to the board for a directly attached LPD8806 strip and a 20*4 LCD display respectively.
From there, I ran a long network cable (about 10m) across my room for RS485 testing. I would have preferred a phone line, but unfortunately I don't have one yet, and the network cable was the only cable at hand that met the electrical requirements and was long enough.
|Pilight central command with attached RS485 line|
On the other end of this line now sits an Arduino, which has already replaced the Raspberry Pi that was once used to drive the WS2801 LED pixel strand there.
I've been working on the serial protocol that is run over the RS485 line and the corresponding Arduino sketch to fix a few glitches. It's now operating properly, and will also allow me to address multiple target devices attached to a single line.
Also, a friend of mine that also happens to be the local Raspberry & Arduino dealer was so kind to provide me with a few more Arduino boards for experimenting, among them an Arduino Mini. I immediately had to try this one out, and after a little bit of fiddling with the cables (the Mini comes without USB, nor does it have a standard-compliant ISP port for programming) and modifying the sketches I was able to integrate it into my system successfully.
|Arduino Mini with MAX485 on breadboard, RS485 line on the right|
I also did a little measuring and was pleasantly surprised that the complete circuit on the breadboard consumes a mere 20mA. That (apart from other improvements like the drastically reduced latency) really is a huge advantage over the Raspberry Pi based solution.
Since all those little experiments have worked out so well, I've also had plenty of time to read up on where to go from here. I'm currently working on a first board that will in turn replace the Arduino again. I've taken the same microcontroller that sits on most Arduinos (the ATMEGA328P), added only the necessary components to make it work, a MAX485 bus driver and headers for ICSP, I2C and SPI. Here's what the design looks like:
|Pilight universal controller board (size: 23*37mm)|
It is slightly larger than the Arduino Mini (the TQFP package of the processor is bigger, and the Arduino does not have RS485) but it's still pretty tiny. I'm curious what case options will be available for such a small board.
I've also thought about a way to get some configuration (like device ids) onto the controllers (that's what the CONFIG jumper is for) but I haven't had the time to test it out yet, so this will be part of a later post.
I've also postponed the production of the new LED dimmer for now, since the current version is designed to be driven by an external controller (in my original plan that would have been a Raspberry Pi). With all those new findings however I'd really like to integrate the controller right into the dimmer itself, which would allow me to directly connect it to the RS485 bus without any additional hardware.
Next steps will be to compile a list of parts for the new controller, since this will most probably be the next device for me to build. I'll post another update on this soon.