Introducing OSWIN, the Open Source Wireless IoT Node

OSWIN
OSWIN with ethernet and RFM12B and XRF radios

OSWIN is the only slightly contrived acronym for my new Arduino compatible Open Source Wireless IoT Node based on the ATmega1284P AVR microcontroller.

I blogged about using the ATmega1284P with the WIZ820io ethernet module last year and was subsequently sent two prototypes based on the same combo to evaluate, the MAX1284 and the Air Sensor Hub. For the last 6 months I’ve been running the MAX1284 prototype as a replacement for my Nanode emoncms gateway, uploading data from my TinyTX sensors to my emoncms installation and it has been rock solid. Inspired by this and with another $10 Seeed Studio PCB voucher burning a hole in my pocket I decided what the world needed was yet another open source Arduino compatible.

If nothing else this will now allow me to point people asking what I am currently using on the receiving end of the TinyTX sensors towards something they can duplicate for themselves and as it has all the standard Arduino features and more it can also be used as an “Arduino on steroids”. The extra resources will certainly come in handy in many projects, including use with some of the RAM heavy GLCD displays and it would help with the RAM problems I ran into with my Nanode based IR web remote control. As well as being Arduino shield compatible and having options for the RFM12B transceiver and ethernet module there is also an Xbee compatible socket allowing use of Xbee or Ciseco XRF radios or a wi-fi version can be created by fitting a Roving Networks RN-XV.

Here’s the spec:

  • ATmega1284P-PU running at 8, 12 or 16MHz
  • 16KB RAM, 128KB Flash, 4KB EEPROM, 2 UARTs, 3 Interrupts
  • Up to 32 Digital I/O, 8 with hardware PWM
  • Up to 8 Analogue inputs
  • RFM12B Transceiver, mounted on the board or via my RFM12B breakout board
  • Socket for WIZ820io W5200 ethernet module
  • XBee compatible socket for XBee or Ciseco XRF low power radios or Roving Networks RN-XV Wi-Fi module
  • Arduino shield compatible
  • Programming via FTDI or ICSP
  • Power from USB or FTDI/ICSP headers
  • RGB status LED
  • Running at 3.3V throughout
  • Dimensions 95 x 80mm
Various plug in modules can be used.
Various plug in modules can be used. Click for annotated version.

Here is a comparison of the ATmega328P used in the Nanode and the ATmega1284P used in OSWIN:

Feature ATmega328P ATmega1284P
RAM 2KB 16KB
Flash 32KB 128KB
EEPROM 1KB 4KB
UART 1 2
IO Pins 23 32
Pins with PWM 5 8
Interrupts 2 3
Analogue Inputs 6 8

I’d previously used Maniacbug’s pinout with the ATmega1284P but once I tried to lay an Arduino shield compatible board out with it I realised it wasn’t going to make much sense so instead, after looking at a few alternatives I settled on the Bobuino pin layout and layed it out to match the original Arduino layout with the exception of I2C which are on the additional header in the same place as on the Arduino Mega boards.

The bootloader and Arduino core I am using is the one for the MAX1284 (based on Maniacbug’s Mighty-1284P) with the pins changed for the Bobuino layout. There are options for running at 8, 12 or 16 MHz, running it at 12MHz or less makes sure it is in spec at 3V3 although in my experience Atmel allow a lot of leeway in their designs so 16MHz will probably be ok in most circumstances, it certainly ran ok when I tested it on breadboard last year but it probably varies from chip to chip. 12MHz is plenty though and I’m looking for stability here.

oswin_xrf_wiz820io_rfm12b oswin_rn-xv_rfm12b oswin_rn-xv_rfm12bb oswin_w5100
With WIZ820io ethernet, XRF low power radio in Xbee socket and RFM12B on board. With RN-XV Wi-Fi module in Xbee socket and RFM12B on board. With RN-XV Wi-Fi module in Xbee socket and RFM12B on a breakout board. With W5100 ethernet shield and XRF low power radio in Xbee socket.

On the front of the board  (at the top top in the pictures above) is a single 5mm RGB LED with each colour connected to PWM pins so some subtle patterns can be created to show what OSWIN is up to during normal operation or a more noticeable warning if something is wrong, for the moment I am just using red to indicate error, green for normal and blue for data received.  The eagle eyed might notice that the LED on one of the boards in the pictures above has been replaced by 3 individual LEDs, that’s only because I didn’t have as many RGB LEDs in stock as I thought I had!

Round the back of the board are a 5V FTDI programming header, reset button, USB socket (for power only) and the WIZ820io ethernet module, I went with a USB B socket for power as they are easy to find in a through hole style and every drawer I open seems to have another spare USB A to B cable stuffed in it whereas micro and mini USB cables always seem to be in short supply here. The 3.3V ICSP programming header is in the standard Arduino position for maximum compatibility with shields.

RFM12B fitted on board (left) and on breakout (right)
RFM12B fitted on board (left) and on breakout (right)

For the RFM12B I added the option of using my RFM12B breakout board as well as mounting it directly on the board as I thought it would be handy for experimentation and upgrades, anyone who has ever had to desolder an RFM12B will know what a pain it is. I’m mounting the WIZ820io via headers too so along with the processor being mounted in a socket it means all the expensive parts can be easily removed for use with future upgraded boards. Of course if one was going into long term use and a lower profile was required you could solder everything directly to the board at the expense of easy removal.

Libraries

It is compatible with the standard JeeLib RFM12B library with just a couple of small changes required to add the pin mapping and allow use of INT2 for the IRQ instead of INT0 (which is on the same pin as RX1 which is assigned to the XBee socket) but don’t worry, this won’t break the library for other boards. It’s also necessary to comment out the include for pins_arduino.h in SPI.cpp (see this bug) in the Arduino SPI library – This has now been fixed in the bootloader. For the WIZ820io you can use the standard Arduino W5100 ethernet library and swap a couple of files round to add support for the W5200 chip but instead I recommend using the ethernet52 library here which will keeps things tidier and save some headaches later if you are using both types of boards.

Case

I picked this enclosure up on eBay which with a bit of dremel action makes a nice compact case for OSWIN.

 oswin_cased oswin_cased_open

Issues

There were a couple of issues with the boards, one very minor – a small error on the silkscreen text where it says the RFM12B interrupt is on D10/INT2, it should read D6/INT2 and a more serious one where I had linked the SS line for the RFM12B from the footprint on the board to the header for the breakout but a last minute change to one of the labels in the schematic left it unconnected to the ATmega, oops! Fortunately it was an easy fix with a single short green wire to link it up. Both these errors have been corrected in the files below. It’s also worth noting that although all the holes for the headers use the alternating offset type footprint that should make the headers easier to fit straight but they didn’t lock as expected, I guess this is down to manufacturing tolerances at Seeed Studio and them not being able to drill holes small enough, I should check the spec on that.

Make your own

As usual I got the PCBs made at Seeed Studio, a little more expensive than my previous boards as they come into the 10x10cm max category which is $15 more but it’s still a very good price, especially when you have a $10 coupon from your last order burning a hole in your pocket. The normal price would be $32.70 for 10, or around £2.71 each. If you want to get your own made the files are all available below and are licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) licence as always so you can modify and share as appropriate.

Downloads:
Schematic (PNG format)
Eagle files
Gerbers
Arduino core and bootloader
Example code for multiple TinyTX sensors to emoncms

The hardware design files are also available on SolderPad.

Parts List for example configuration with RFM12B and ethernet:
OSWIN PCB
ATmega1284P-PU microprocessor
40 pin DIP socket
RFM12B transceiver
WIZ820io ethernet module
MCP1702-33 LDO Voltage regulator
10uF electrolytic capacitor
7 x 0.1µF (100nF) 2.5mm  ceramic capacitors
2 x 1µF 2.5mm  ceramic capacitors
2 x 22pF 2.5mm ceramic capacitors
12MHz crystal
Through hole USB B socket
Right angle tactile switch
Common cathode RGB LED
3 x suitable resistors for RGB LED (For the one I used it was 68 Ohm for red and 5.6 Ohm for green and blue)
10k resistor
3 way 2.54mm male pin header and jumper for power selection
2 x 3 way 2.54mm male pin header for ICSP connector
6 way straight or preferably right angle 2.54mm male pin header for FTDI connector
Other 2.54mm female headers for Arduino shields/RFM12B breakout/WIZ820io as required
2 x 10 way 2mm female header for Xbee socket if required
Wire for RFM12B antenna, eg. 0.6mm solid core (165mm for 433MHz, 82mm for 868MHz)

 

Open Source HardwareThis is Open Source Hardware licenced under a
Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) licence.

6 thoughts on “Introducing OSWIN, the Open Source Wireless IoT Node

  1. Hi Nathan,

    fantastic project. I would very much like to try it. So i built up a minimum 16Mhz Atmega1284p-pu board. I installed your optiboot_atmega1284p_16MHz.hex boot loader software via AVRISP on a Duemilanove board. Then i tried to upload a simple blink application to the Atmega 1284p board using OSWin ATMega1284p 16MHz using Optiboot as the default board. For the serial transfer to the board i use a Sparkfun FTDI board which is connected to RESET, TXD, RXD and GND of the test board. Oops nothing happened and Avrdude comes with this error:

    /Applications/Arduino105.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino105.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega1284p -carduino -P/dev/tty.usbserial-A6007CsC -b115200 -D -Uflash:w:/var/folders/wr/_f_q172d4kxgcg2b0mxgq1zm0000gn/T/build5740970305781799119.tmp/Blink.cpp.hex:i

    avrdude: Version 5.11, compiled on Sep 2 2011 at 18:52:52
    Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
    Copyright (c) 2007-2009 Joerg Wunsch

    System wide configuration file is “/Applications/Arduino105.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf”
    User configuration file is “/Users/yoali/.avrduderc”
    User configuration file does not exist or is not a regular file, skipping

    Using Port : /dev/tty.usbserial-A6007CsC
    Using Programmer : arduino
    Overriding Baud Rate : 115200
    avrdude: Send: 0 [30] [20]
    avrdude: Send: 0 [30] [20]
    avrdude: Send: 0 [30] [20]
    avrdude: ser_recv(): programmer is not responding
    avrdude: stk500_recv(): programmer is not responding

    The bootloader is not answering. Is that right?

    As you can see i am working with a mac.

    So i installed the Orignal Mighty 1284p 16MHz on my board and tried again to upload the blink prog. This works. To be honest sometimes it works not always. Is the AtMega 1284p such a difficult chip or am i thinking in the wrong direction. I have installed a 10K Resistor to VCC as pull-up and the Reset is connected via 0.1uF.

    I installed some of the software from Nick Gammon (ATmega Board Detector) to see the fuses and the memory on board. It looks good. Everything seems to be in the right place. If only these issues in the uploading wouldn’t be.

    Can you give me push in installing your OSWin ?

    Sorry to bother you with my problems. Thanks for a short note.

  2. If you are running at 3.3v then it is slightly out of spec at 16MHz so that could cause it to be a bit flaky I suppose, I haven’t had any issues like that at 12MHz & 3.3V.

    That Maniacbugs bootloader is working sporadically where as mine isn’t working at all is puzzling although I have to say I haven’t tried the 16MHz one, it came straight from the MAX1284 files and my original experiments at 5V and 16MHz were with Maniacbugs version. There are a couple of problems with his bobuino pin layout that are corrected in my variants/bobuino/pins_arduino.h file though so you might want to copy that over. If I get chance I’ll check the 16MHz version out again.

  3. Hi Nathan,

    thanks for sharing your detailed project.
    This is my first project, and I started building the oswin and some tinytx3 nodes. All goes well, using an arduino UNO as a ISP to burn the bootloader into the oswin and the tinytx.

    Uploading of the OSwin sketch results in a error.

    Do you recognize this error, and do you have any idea how to fix this?

    ethernet52\utility\w5200.cpp.o:C:\Users\ \Arduino/libraries\ethernet52\utility/w5200.cpp:149: multiple definition of SPI

    SPI\SPI.cpp.o:C:\Program Files (x86)\Arduino\libraries\SPI/SPI.cpp:44: first defined here …..

    Warning: size of symbol SPI changed from 1 in SPI\SPI.cpp.o to 2 in ethernet52\utility\w5200.cpp.o

    Thanks in advance for your help.

  4. Hi Nathan,

    no problem. I managed to compile the oswin code after commenting the #include spi.h.
    Had troubles uploading the sketch via ICSP. Today my ftdi programmer arrived and uploaded the sketch succesfully. But the led turns red ;-(. Via a serial interface i see OSWIN 2.0 Multiple TX to emoncms RFM12b support enabled Node 30: Freq 433 MHz Network group: 210. NTP time transmit enabled.

    No errors are shown.
    Have to start debugging.
    Any ideas?

    Regards Johan

  5. Second oswin board does boot,and is in a loop.

    Getting NTP Time
    ——————————–
    OSWIN 2.0 Multiple TX to emoncms
    RFM12B support enalbed Node: 30 Freq: 433MHz Network group: 210
    NTP Time transmit enabled
    IP: 10.10.10.111
    ——————————–

    It does get an ip address from dhcp, i think it fails to connect to the ntp server.

    I keep on debugging ;-)

    Regards Johan

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.