RasPiComm API

The RasPiComm API is here!

Martin did all the hard work and now it’s online: https://github.com/amescon/raspicomm

Check out the readme.md for instructions on how to install and use it. There is also a Demo-Tool where you can test the basic functions of the board.

We also added a deamon which you can use to forward RS485 communication via TCP/IP. We used it to make an Andoid App to control a stepper motor. Videos will follow soon!

RasPiComm Update

RasPiComm v3

I want to give you a short update about the status of the RasPiComm project.

We already have ordered parts for the first production batch of 1.000 RasPiComms. We expect all parts to arrive in 4 weeks, so the RasPiComm will be available in approximately 6 weeks.

RS-Components!
We are also had a conversation with RS-Components. We are very confident that they will add the RasPiComm to their product lineup! So if everything works out the RasPiComm will be available worldwide!

Raspberry Pi with RasPiComm

Raspberry Pi with RasPiComm

The RasPiComm will most probably get a distinctive subsite on Designspark.

I made some changes to the final board, most of them are minor layout changes.

I2C
The pull-ups for the I2C were removed since they are already present on the Raspberry Pi. I still have to check how the I2C pull-ups are with the RasPi rev2.

ESD Protection
I also made an important change to the RS-232 and RS-485 ports. I added TVS-diodes for protection which is a massive improvement in terms of stability.

Here are the specs of the ESD-protection:

RS-232 port:

  • 300 watts peak pulse power (tp = 8/20µs)
  • ‹40 watts peak pulse power (tp = 10/1000µs)
  • ‹Transient protection for data and power lines to
    • IEC 61000-4-2 (ESD) ±15kV (air), ±8kV (contact)
    • IEC 61000-4-4 (EFT) 40A (5/50ns)
    • IEC 61000-4-5 (Lightning) 12A (1.2/50µs)

RS-485 port:

  • 400 watts peak pulse power (tp = 8/20µs)
  • ‹Transient protection for asymmetrical data lines to
    • IEC 61000-4-2 (ESD) ±15kV (air), ±8kV (contact)
    • IEC 61000-4-4 (EFT) 40A (5/50ns)
    • IEC 61000-4-5 (Lightning) 12A (8/20µs)

RasPiComm Technical Specifications

RasPiComm Technical Specifications

  • Size: 35,2 x 56mm
  • RS-485
    • up to 230.400 baud
    • pluggable screw terminal connector (A, B, GND)
  • RS-232
    • No hardware handshake
    • up to 115.200 baud
    • pluggable screw terminal connector (RX, TX, GND)
  • Real Time Clock
    • battery included
    • powers the clock for approximately 10 years
    • counts seconds, minutes, hours, date of the month, month, day of the week, and year with leap-year compensation valid up to 2100
  • 5 Inputs
    • connected to onboard joystick (4 way + push)
    • 5V tolerant
    • 2mm pitch external connector, not polulated
  • 2 Outputs,
    • 5V, 100mA max. each
    • 5V relays can be connected without additional circuitry
    • 2mm pitch connector, not populated
  • SPI Connector
    • 2mm pitch connector, not populated
  • 2 I2C Connectors
  • Power Connector
    • pluggable screw terminal connector (+, -)
    • either powers the Raspberry Pi and RasPiComm (5V, 1.5A max)
    • or is a power output when powered over USB
  • RasPiComm Power Ponsumption
    • max. 10mA (outputs off)
    • max. 210mA (outputs on and maximum rating drawn)

Raspberry Pi and RasPiComm Enclosure

RasPiComm Case

RasPiComm Enclosure

So now here it is: The RasPiComm enclosure. You can download the STL for printing from thingiverse.com:

http://www.thingiverse.com/thing:29521

The case features a slot for the RasPiComm pluggable headers. It also provides a mounting hole for the RasPiComm board where it can be screwed to the case. The hole for the screw has a 2.5mm diameter. I used a thread cutter to cut a 3mm thead into the plastic, this worked very well.

I also added a little nose above the ethernet jack which holds the Raspberry Pi down, see the pictures below.

The cover has a Raspberry Pi Logo cutout for ventilation.

Below you see some photos of a print using the Makerbot Replicator. You will find infos about how I printed the case on thingiverse.

RasPiComm v3 almost ready

RasPiComm v3 missing headers

RasPiComm v3 missing headers

I assembled RasPiComm v3 and it all works. This should be the design for production. Sadly the new connectors for the RS-485 and RS-232 ports still need 2 (!) more weeks to deliver, I ordered them 2 weeks ago. I only have the 2-pin pluggable power header yet, and only one half (the pluggable screw-terminal also takes another 2 weeks). So the picture to the right is still missing the pluggable headers, but you get the idea of the new design.

I had to make room for the new (big) pluggable headers, so the outputs are now on 2mm pitch headers (not polulated). SPI and input are also 2mm pitch headers and also not polulated. If you need the inputs, outputs or SPI you just need to solder the headers. I think most useres wont need them, and if you do it is easy to retrofit.

I2C Header

RasPiComm OLED

Raspberry Pi with RasPiComm OLED

I changed the I2C header from through-hole to SMD, simply because the battery holder is now below this header to avoid collision with the S2 header of the Raspberry Pi. This will probably be a male connector on the production board.

Production
I know, what you are really interested in is the availability. Well, I already got the quote for the first batch, way off my initial calculation, but they screwed up the material costs. They now have my BOM and I’m waiting for another quote. So I’m still on it and hoping that I can place the order in one or two weeks.

RasPiComm vs Gertboard

After the availability announcement of the Gertboard, a couple of days after my first post about the RasPiComm, questions arose on some blogs whether the RasPiComm is an alternative to the Gertboard or not.

So here is the answer: It is not!

The gertboard, especially the first YouTube video about it, has been around for a while. Gert van Loo is the father of this platform. These two boards have very few in common. The Gertboard is an easy-to-assemble board with a lot of features. It comes as a self-assembly kit, it is perfect for educational purposes. All you need is a soldering iron and a little bit of time and you can learn a lot and have fun!

The RasPiComm, as its name indicates, is specialized more on serial communication. It comes fully assembled, and it’s optimized for minimum space requirement. The highlight of the RasPiComm is its RS485 connector.  There are already lots of boards with relays, (stepper-)motor control and all the stuff you can imagine which can be connected via RS485. The advantage is that you can use long cables (only 2 wires needed) to control these boards (4000ft or 1200m are allowed with RS485!) and that you can connect up to 256 boards to the RasPiComm.

Here is a feature comparison chart:

Gertboard RasPiComm
Self-assembly kit assembled
Connected to RPi with flat-cable Piggyback board (no cable needed)
12x buffered I/O 5x unbuffered Inputs
3x push buttons 5x pushbuttons (4-way joystick with center-push)
6x open collector drivers (50V, 0.5A) 2x open collector drivers (5V, 0.2A)
48V, 4A motor controller
28-pin dual in line ATmega microcontroller
2-channel 8/10/12 bit Digital to Analogue converter
2-channel 10 bit Analogue to Digital converter
2-channel 8/10/12 bit Digital to Analogue converter
SPI connector to ATMega SPI connector to Raspberry Pi
I2C connector
Real-time clock (RTC)
RS-232
RS-485

I think the comparison chart shows pretty well that these two boards have totally different foci. So go ahead and buy both 🙂

RasPiComm v3

I want to give you a short update about the RasPiComm progress. You’ll find the schematics of v3 below.

I reworked the whole board and rerouted it all. I tried to implement as much feature requests as I could while preserving the footprint.

I also decided to start working on a RasPiComm Plus board. It will be bigger and better! But it will not play in the same league pricewise.

But first things first, here are the changes I made:

  • Moved the backup battery out of the way. Now it does not collide with the DSI (S2) plug on the Raspberry Pi.
  • 5V tolerant inputs
  • pluggable terminals for power, RS232 and RS485
  • supressor diodes for the outputs. You can now directly connect relays to the outputs
  • output is now a pinheader. The RasPiComm focus is on serial communication. Sacrifice I had to made to get the pluggable terminal headers in.
  • Extra 2 pin header for 5V fan. In case you want active cooling on the Raspberry Pi
  • Changed the through-hole joystick to a SMD variant. That resolves a little issue with the aluminum capacitor of the Raspberry Pi. No need for a tape or PCB support below to prevent accidental joystick activation
  • Extra tantal capacitor for external 5V power supply through the power header
  • SPI header

Shipment: Since my first post about the RasPiComm about 1 week ago I got a lot of positive feedback, so I really want to push v3 to production soon. Please give me a little time for finding the right partner for that. Eben Upton (Director of the Raspberry Pi foundation) is helping me to get this to Element14 (Farnell), this would be my preferred partner. Thanks Eben for your support! But as they are very busy with the Gertboard right now I don’t know about the timeframe yet. So I am working on it!

And thank you all for all the nice comments on my first blogpost about this! You all keep this going!

Downloads (Creative Commons Attribution-ShareAlike License)

RaspiComm_v3_schematics

 

RasPiComm – Hardware

Thank you for all the views and responses on my original RasPiComm blogpost!

Here I want to explain the RasPiComm hardware. The software part will follow next week.
At the end of the post you will find the schematics of the RasPiComm version 1 and version 2.

If you are not interested in the RasPiComm hardware, take a look at the original RasPiComm blogpost!

Now, let’s start!

Version 1 vs. Version 2

RasPiComm version 1

RasPiComm version 1 with populated RS-485 driver

As I mentioned in the first blogpost about the RasPiComm, I did two versions of the board. The first version had either one serial port OR an RS-232 port. I used the /dev/ttyAMA0 (TX on GPIO header pin 8 and RX on pin 10. You could either solder the MAX3232 for RS-232 or the MAX3483 for the RS-485 port. But there was another disadvantage: I used the GPIO1 (pin 12 on the GPIO header) for switching between receive and send mode.
Just a short explanation why you need to switch between send and receive mode: Unlike RS-422, RS-485 is an unidirectional bus system. That means that you use the same wires for sending and receiving data, so you cannot send and receive at the same time. Usually you always stay in ‘receive’ mode. If you want to send data you switch to the send mode and return to receive mode immediately after sending your data. The timing is critical here, I will explain that later. There are chips out there which support “auto-direction” from Maxim. I have not yet worked with them, I’ll probably will have a look at them in the future.
Another thing that changed is that version 1 had a SPI header. I removed them simply because the wiring of the SPI tracks would not have been optimal (they are not optimal yet but way better this way).

Changing to RS-485 via SPI

RasPiComm to Rasberry Pi Connector

So the disadvantage of version 1 is obvious: You could either have RS-232 or RS-485, not both. There was another problem. Switching the GPIO line for changing between receive and transmit was suprisingly slow. Not exactly because the GPIO switching is too slow but because it is not so easy to find out when the last byte was transmitted completely to switch back from send mode to receive mode. You can check if the /dev/ttyAMA0 send-buffer is empty using tcdrain(). Sadly this function blocks too long, we lose valuable miliseconds after sending until we can switch to receive mode and receive data. That means that all data that is sent by a RS-485 client before switching back is lost.
To overcome this limitation, and the problem that I can only use either RS-232 or RS-485 I dropped the MAX3483 and used the MAX3140 in version 2. This chip has an SPI-UART and RS-485 controller in one chip.
The interrupt line of the MAX3140 is connected to GPIO0 (pin 11).

RS-232
The RS-232 connector is driven by a MAX3232, I will probably replace it with another, cheaper version for the production board. Only TX and RX are connected, sadly the Raspberry Pi does not bring both CTS and RTS to the GPIO header, so hardware handshake is not supported. But this is not used often anyways.

I2C Connector
If you look closely at the I2C connector in the schematics you will see that this are actually two I2C connectors. It is a 2×4 header, and unlike all other headers row 1 and row 2 are not identical. I did that for a simple practical reason. I use this header mainly to connect I2C displays. There are two common pin layouts:

  • 5V, GND, SDA and SCL
  • 5V, GND, SCL and SDA

So I did both of them. With that little trick you can connect both types directly to the board using either row 1 or row 2.

Inputs
All 5 inputs are pulled-down to GND. They are all 3.3V inputs with an 1k resistor to the Raspberry Pi.

Outputs
Both outputs are open-collector outputs and switched with a BC847 transistor.

Power connector (3.3V, GND, 5V)
The 5V line can be used to supply 5V if you do not use the USB plug or use it as 5V ouput if the Raspberry Pi is connected via USB.
The RasPiComm generates its own 3.3V from 5V, the 3.3V line is connected to this output (200mA combined maximum rating).

RTC with backup battery

RasPiComm bottom

RasPiComm bottom

The backup battery on the bottom side of the PCB is a CR2032 cell. It should power the DS1307 for approximately 10 years. Currently there is a small problem with the battery holder on the bottom – it collides with the S2 socket (DSI). The RasPiComm v2 still can be connected to the Pi, but you cannot push it all the way down (it’s only 1mm). For testing I removed the S2-connector from my Raspberry Pi board. For the production version the PCB will get 5mm wider (did it without changing PCB size!) the battery socket is moved out of the way. It won’t change the footprint of the Raspberry Pi, the 5mm go torwards the video connector. That also means that the battery is slightly moved over the processor. This should not raise any temperature problems, neither for heat dissipation nor for the battery since the operational temperature range for the CR2032 cell is -20 to + 70 degrees Celsius (-4°F to +158°F).

Downloads (Creative Commons Attribution-ShareAlike License)

RasPiComm v1 schematics

RasPiComm v1 schematics

RasPiComm v2 schematics

RasPiComm v2 schematics

RasPiComm – a Raspberry Pi piggyback board

Raspberry PI Communication and I/O board

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.

Features

  • 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?

RasPiComm Connectors

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.

RS-232
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.

5 inputs
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.

2 outputs
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).

I2C connection

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?

RasPiComm Hardware
RasPiComm v3

Arduino/Netduino GSM Shield

 

Versatile Arduino/Netduino GSM shield

I needed a way to send SMS messages from a Netduino board, so I first tried the SM5100B shield. It worked somehow but it was not very stable and I did not like the hardware design. It also lacked some features. So I decided to build my own. Here is what I did (if you already used Arduino/Netduino the nomenclature below will be familiar, if not read a little bit about Arduino or Netduino, its a really nice microcontroller platform):

I wired both serial ports (so you can open a data connection and still send AT commands through the other line), A2 and A3 are used for ignition and hard reset of the gsm module and D12 and D13 are used for the ring indicator (signals events) and power indicator. These two lines are optional so I added an smd jumper pad which is connected and can be cut easily. the same is for the second serial interface.

I also added a battery holder for backing up the RTC in the module, so you do not lose the time stored in the module. Also very handy.
The SIM card holder is a push-lock and is on the bottom of the PCB facing to the side with the usb and power connector, so when a housing is used you can cut a slot into the housing and change the sim-card without opening it.

The USB port can be used to configure the GSM board, but this is optional. All settings can be made through the RS232 interface.

%d bloggers like this: