RasPiComm on Raspberry Pi
Update: visit our forum on our freshly relaunched website amescon.com to comment or ask questions about the RasPiComm!
After finding out about the GPIO header of the Raspberry Pi it was inevitable to build some kind of extension board for it. I was working with Arduino, Netduino and FEZ Boards in the past and they all are quite expensive compared to their capabilities and not really stable, especially when it comes to Ethernet communication. The Raspberry Pi seemed to be a perfect alternative for complex applications and easy development. Of course it is an application processor not a microprocessor, so they are not quite comparable but nevertheless a great platform for a very decent price. I want to thank the Raspberry Pi team for bringing out this awsome piece of hardware!
After checking out the available documentation I built the first version of the extension board. Even though it was working as intended I wanted to get rid of some limitations so I built v2 which is slightly different. I will write a seperate blogpost about the technical details, here I just want to share the basic concept and capabilities.
- RS-485 port
- RS-232 (‘serial’) port
- 5 inputs connected to an onboard joystick and screw terminals
- 2 outputs (5V) with LEDs (green and red) also connected to screw terminals
- I2C connection
- Real time clock (RTC) with backup battery
What for? RS-485! And why?
The main reason I built the RasPiComm was the RS485 interface to control stepper motors. You can of course use I/Os in PWM mode and a second I/O for direction to drive this, but since the Raspberry Pi is not a realtime system it does not behave well especially with start/stop ramps. And you would have to write code that does all of that. But I like elegant solutions, and this is certainly not one. There are a lot of stepper motor controllers out there with rs485 support. I’m using the steprocker board (http://www.motioncontrol-community.org), a very powerful open-source solution with state-of-the-art stepper control. This board supports a 256 microstep resolution for ultra-smooth stepping. And it implements the TMCL protocol, which is very easy and fast. The neat thing about RS-485 is that you can control up to 256 devices. The steprocker board is capable of driving up to 3 motors. So if you want you can control 768 stepper motors with one Raspberry Pi. If you really want to.
This is always nice to have. It simply connects to your “/dev/ttyAMA0” serial device to the outer world. It outputs the correct RS-232 levels so you can connect it directly to a PC serial port if you want. You can open a console and watch the debian debug output for example.
I added them because the GPIOs are there and I don’t like unconected I/Os. Who knows, someday I (or you?) will need them. The onboard joystick is handy for launching actions and to test your program.
The main reason for adding them were the LEDs. In version 1 these 2 outputs were only connected to two LEDs. In version 2 I added 2 transistors and they switch 5V. I added screw terminals, so if you want you can connect two relays (with a supressor diode).
RasPiComm with 128×64 pixel OLED display
The I2C connection is also connected to a header. I attached a small I2C OLED display. There are a number of cheap I2C displays on ebay.
Real time clock (RTC)
And last but not least: I attached a real time clock to the I2C bus. The Raspberry Pi does not come with a hardware clock. It forgets the time when it looses power. Its very well understandable that they did not do that, the RTC chips aren’t cheap. But nevertheless a clock is a nice thing to have, especially if you want to trigger actions based on the time of day (home automation for example).
I placed the battery on the backside of the board. Debian supports the chip I used directly, so there was no programming, it simply works with a few calls and your system time is synced with the hardware clock.
Piggyback board design
As I mentioned before, I like elegant solutions. And I also like compact solutions. So my goal was to create a small, elegant extension board without using a flat cable to connect to the Raspberry Pi, my desk already is cluttered enough. It should be a shape which does not change the footprint of the Raspberry Pi and doesn’t cover the processor to maintain heat dissipation. Ths ‘piggyback’ design was born. It doesn’t provide a lot of PCB-space, but there is still plenty of room to realize a couple of features if you go with smaller SMD parts. They are all still hand-placable since I only use tweezers to populate my prototype boards.
In part two I’ll cover the technical details and software.
If you have ideas how to improve the RasPiComm go ahead and post a comment. Want to see other features? Form factors? Colors?