- Category: OpenKontrol gateway
- Last Updated on Wednesday, 21 May 2014 15:19
First use and testing
The OpenKontrol Gateway is a kit based around the Atmel ATMega328 micro processor, allowing communication between many common mediums and protocols. It is totally compatable with the Arduino IDE and many of its existing libraries so programming is very straight forward. In it's simplest form it can be used as a repeater between one device and another. With support for SD cards, real time clock and additional memory it allows it to be used as an inteligent hub or datalogger. Depending on your needs, and what modules you will use, it can be built with only the elements you need, and expanded at a later date if required.
The following devices have been tested with the OpenKontrol Gateway; XRF, XBT, X232, XBee, XV, RFM12b, NRF24L01, Ethernet (via ENC28J60), Ethernet (Via Wiznet W5200), SD card, DS1307 RTC, 23K256 SRAM. Due to nature of 328 and Arduino development, many other devices will work with the OpenKontrol Gateway, or can easily be modified to do so. (If you are using any other hardware with the OpenKontrol Gateway, please let us know so we can add it to the list)
The Starter Kit contains the main PCB, which is the heart of the OpenKontrol Gateway. The header and component kit contains all the headers, sockets, connectors and basic components to allow the board to be built in to a gateway. If you only need to echo messages to and from one XBee device to another then this is all you need. The addition of an ATMega328, which is programmed via the FTDI connector, will allow more control over how these devices communicate, as well as give the option of other devices.
When you buy your OpenKontrol Gateway you can pick and choose which options you wish to use. Whilst it is easiest to build your OpenKontrol Gateway with the options installed from day one, all options can be fitted later. The SD card reader, however, is a real fiddly part to retro-fit, so if you think you might want this one day we suggest you put it in at the start!
Thanks Matt for this picture
Before you begin assembly of your gateway, familiarise yourself with the various components and where they go on the PCB. As the gateway has different module options you may not have components in every slot on the board. Assembly is quite straight forward, using through-hole components. If you are new to soldering, or need to brush up on rusty skills, there are plenty of online tutorials that are worth looking at.
The Header Kit has been recently updated (21 May 2014) and there is a change to the supplied Polorised capacitors. Previous kits were supplied with two 100uf 16V caps, we are now suppliing one 100uF 10V and one 10uF 25V capacitor.
Please see the picture below for details of where these should be installed on the PCB.
NOTE for v1.0 (NOT v1.01) There is a mistake, at the final minute we made an update so that the FTDI programming cable had priority over the left hand radio, in the rush we got two resistors crossed, they will need soldering in crossed fashion to undue the mistake. They are the 2 x 1K above the NRF24L01 legend. The error was corrected for v1.01 of the board.
Thanks Matt for this picture (the crossed leads are not touching)
There may be 2 surface mount components; the SD card socket and RFM12B radio. If you will be using either of these options, we suggest you mount these to the board first. After checking orientation and alignment, apply a small bit of solder to the pads where this will go. Put the SD card socket or RFM12B over the pads, and warm the tabs so it melts the solder below. Once the solder below starts to melt, add a little bit more from the top to ensure a good connection. The 'dummy' SD card should remain in place when soldering the SD card socket to prevent distortion.
Build up the rest of the components on the board, starting with the lowest ones (horizontal resistors) and work up to the tallest (voltage regulator). The LEDs, electrolytic capacitors, voltage regulators, batter and chip sockets are all polarised, so ensure the markings on the component match the legend on the board. The other capacitors, resistors, crystals and sockets are not polarised, so can be fitted either way around.
When fitting the jumper pins, it is handy to put a jumper across the two rows of pins before soldering them so they line up properly. Likewise, fitting the header pins to an XRF/XBee/XV before soldering the headers to the board will ensure they are straight and correctly spaced. The two LEDs on the rear of the board (power & status) should be mounted 6mm clear of the PCB. This will allow them to be bent through 90 degrees so they protrude through the rear panel.
If you are using the bespoke case, then place the PCB in the lower half to work out which is the front and rear. There is a subtle difference which can be seen by looking how the screw holes line up. Remove the PCB, slide in the back panel, and refit the PCB. (You may need to go in at an angle to get some connectors through the rear panel). Fix the PCB in place with the screws supplied. Slide the front panel in place, fit the top of the case and fasten using the larger screws.
FTDI VIN enable
Do not connect this by default, it is to connect the FTDI cable power to the board, if you have a 5v FTDI cable you could damage anything needing 3V3. If you are 100% certain your FTDI cable is 3V3 and you don't want to power through the jack but would rather the FTDI cable then you can connect this AND we suggest you replace the wire link with a Shottkey diode, the 1117 is robust but it never hurts to be safe. If you power at 3V3 the RTC wont work as it needs 5V.
Why did we include this? it was useful in our testing and a few % of people might like the feature, for everyone else, we suggest you just ignore it.
The RTC chip we chose for the gateway is an I2C based DS 1307. This chip, unlike all the other gateway devices, needs 5v to run. This is supplied from the main power jack via a 5v regulator.
There is no problem in interfacing the 5v RTC to the rest of the circuit (3v3) as the SDA pin uses an open drain output (when the chip is sending data to the 328). The 328 supplies the pullup to 3v3 and the DS1307 merely pulls the line to 0v when needed. So the 5v never appears on the data line.
There are many examples of using a DS1307 with an Arduino available on the web. This link is a good place to start http://arduino.cc/playground/Code/Time
XBee sockets Serial Jumper selection
The jumpers select if the XBee sockets are connected to the 328 chip. Pictured is their default configuration where the left hand XBee socket is wired to UART and the left to soft serial. Using flyleads it is possible to reverese this or by moving just the jumpers it is possible to cross RX&TX between the two xbee sockets, this is for later use.
For now install the jumpers as shown.
Opt 10K resistor on left hand XBee socket.
If you experience spurious data whilst doing over the air programming on a v1.3 or v.14 XRF, installing this resistor will prevent the XRF input pin from floating.
By default we suggest you do not install this resistor.
Powering your gateway
We suggest using a 5v or 6v PSU this will keep heat down in the regulator to an absolute minimum.
We have tested the gateway at 12v, we have a BIG word of caution....If you have Ethernet installed 12v will cause far too much heat in the regulator so should not be used even if you have bolted the regulator to the board. You also need to be aware that the inout capacitor is only rated at 10
If you have for a example an XRF and RN-XV installed then the regulator once bolted to the board will be fine.
Full scematic of the OpenKontrol Gateway can be found in the data which can be downloaded from here
|4||FTDI Vin*||Not connected by default|
WIZNET W5200 Ethernet board
The Wiznet board uses a slightly modified version of the standard Arduino Ethernet library. There are two files you will need to replace; w5100.h and w5100.cpp. You can down load them from
These two files should overwrite the existing two files in the /libraries/Ethernet/utility folder.
Any sketch written for the W5100 can now run on a W5200 with the addtion of a
line at the top of the sketch.
Microchip ENC28J60 board
There are two libraries in common use, support seems now to be going into the JeeLabs one only
Older library which is what many Nanode sketches are based on
First use and testing
Before fitting any chips or expansion modules, plug in to a 6 - 14V power supply and use a voltmeter to verify the voltage with respect to ground at the following points;
ATMega328 Pin 7 - 3.3v
ATMega328 pin 20 3.3v
XBee Socket 1 pin 1 - 3.3v
RTC Pin 4 - 5v (If fitted)
RTC pin 7 - 3v (If fitted)
If all of these check out ok remove the power and fit the chips.
Test code to verify the operation of each aspect of the gateway can be found here; http://www.openmicros.org/index.php/articles/92-ciseco-product-documentation/openkontrol-gateway
The OpenKontrol Gateway is based on an Atmel ATMega 328 micro, so to all intents and purposes it is an Arduino equivalent and should be programmed with the Arduino IDE. This is a free development environment which can be downloaded from http://arduino.cc/en/Main/Software
The OpenKontrol Gateway has a standard 6 pin FTDI interface. There are a few options you have for connecting to this to program it;
- A regular USB to FTDI interface cable
- A URF with 6 pin header soldered on and serial jumper connected
- A USB FTDI interface with 6 jumpers to the FTDI interface
- An ERF in OKG and URF in PC, both configured for Over The Air Micro Programming
- An XRF onboard configured for Over The Air Micro Programming
- Put the 328 micro in to a regular Arduino clone to program it before swapping it back
- Use a regular Arduino clone with the processor removed and the 3v3, gnd, tx & rx jumpered across
Any of these options will show up as a COM port which you can select in the Arduino IDE. The board should be set to Arduino Uno (unless you have supplied a different micro yourself).
Note that the OpenKontrol Gateway also has a ISP header which can be used if you have a suitable programmer.