Archive | wireless

Book – “Arduino Workshop – A Hands-On Introduction with 65 Projects”

Over the last few years I’ve been writing a few Arduino tutorials, and during this time many people have mentioned that I should write a book. And now thanks to the team from No Starch Press this recommendation has morphed into my new book – “Arduino Workshop“:

shot11

Although there are seemingly endless Arduino tutorials and articles on the Internet, Arduino Workshop offers a nicely edited and curated path for the beginner to learn from and have fun. It’s a hands-on introduction to Arduino with 65 projects – from simple LED use right through to RFID, Internet connection, working with cellular communications, and much more.

Each project is explained in detail, explaining how the hardware an Arduino code works together. The reader doesn’t need any expensive tools or workspaces, and all the parts used are available from almost any electronics retailer. Furthermore all of the projects can be finished without soldering, so it’s safe for readers of all ages.

The editing team and myself have worked hard to make the book perfect for those without any electronics or Arduino experience at all, and it makes a great gift for someone to get them started. After working through the 65 projects the reader will have gained enough knowledge and confidence to create many things – and to continue researching on their own. Or if you’ve been enjoying the results of my thousands of hours of work here at tronixstuff, you can show your appreciation by ordering a copy for yourself or as a gift :)

You can review the table of contents, index and download a sample chapter from the Arduino Workshop website.

Arduino Workshop is available from No Starch Press in printed or ebook (PDF, Mobi, and ePub) formats. Ebooks are also included with the printed orders so you can get started immediately.

LEDborder

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, Arduino Workshop, book, books, cellular, clocks, display, distance, ds1307, DS3232, education, EEPROM, freetronics, GPS, graphic, GSM, hardware hacking, I2C, internet, LCD, learning electronics, lesson, no starch press, numeric keypad, part review, product review, projects, RDM630, RDM6300, relay, review, sensor, servo, SMS, time clock, timing, tronixstuff, tutorial, twitter, wireless, xbee13 Comments

Arduino tutorial 15a – RFID with Innovations ID-20

Learn how to use RFID readers with your Arduino. In this instalment we use the Innovations ID-20 RFID reader. The ID-12 and ID-2 are also compatible. If you have the RDM630 or RDM6300 RFID reader, we have a different tutorial.

This is part of a series originally titled “Getting Started with Arduino!” by John Boxall – A tutorial on the Arduino universe. The first chapter is here, the complete series is detailed here.

Updated 26/02/2013

RFID – radio frequency identification. Some of us have already used these things, and they have become part of everyday life. For example, with electronic vehicle tolling, door access control, public transport fare systems and so on. It sounds complex – but isn’t. In this tutorial we’ll run through the basics of using the ID-20 module then demonstrate a project you can build and expand upon yourself.

Introduction

To explain RFID for the layperson, we can use a key and lock analogy. Instead of the key having a unique pattern, RFID keys hold a series of unique numbers which are read by the lock. It is up to our software (sketch) to determine what happens when the number is read by the lock.  The key is the tag, card or other small device we carry around or have in our vehicles. We will be using a passive key, which is an integrated circuit and a small aerial. This uses power from a magnetic field associated with the lock. Here are some key or tag examples:

In this tutorial we’ll be using 125 kHz tags – for example. To continue with the analogy our lock is a small circuit board and a loop aerial. This has the capability to read the data on the IC of our key, and some locks can even write data to keys. And out reader is the Innovations ID-20 RFID reader:

Unlike the RDM630 reader in the other RFID tutorial – the ID-20 is a complete unit with an internal aerial and has much larger reader range of around 160 mm. It’s a 5V device and draws around 65 mA of current. If you have an ID-12 it’s the same except the reader range is around 120mm; and the ID-2 doesn’t have an internal aerial. Connecting your ID-20 reader to the Arduino board may present a small challenge and require a bit of forward planning. The pins on the back of the reader are spaced closer together than expected:

… so a breakout board makes life easier:

… and for demonstration and prototyping purposes, we’ve soldered on the breakout board with some header pins:

 The first thing we’ll do is connect the ID-20 and demonstrate reading RFID tags. First, wire up the hardware as shown below:

If you’re using the breakout board shown earlier, pin 7 matches “+/-” in the diagram above. Next, enter and upload the following sketch (download):

Note that we’re using a software serial port for our examples. In doing so it leaves the Arduino’s serial lines for uploading sketches and the serial monitor. Now open the serial monitor window, check the speed is set to 9600 bps and wave some tags over the reader – the output will be displayed as below (but with different tag numbers!):

Each tag’s number starts with a byte we don’t need, then twelve that we do, then three we don’t. The last three aren’t printable in the serial monitor. However you do want the twelve characters that appear in the serial monitor.  While running this sketch, experiment with the tags and the reader… get an idea for how far away you can read the tags. Did you notice the tag is only read once – even if you leave it near the reader? The ID-20 has more “intelligence” than the RDM630 we used previously. Furthermore when a tag is read, the ID-20 sends a short PWM signal from pin 10 which is  just under 5V and lasts for around 230 ms, for example:

id20pulse

 This signal can drive a piezo buzzer or an LED (with suitable resistor). Adding a buzzer or LED would give a good notification to the user that a card has been read. While you’re reading tags for fun, make a note of the tag numbers for your tags – you’ll need them for the next examples.

RFID Access System

Now that we can read the cards, let’s create a simple control system. It will read a tag, and if it’s in the list of allowed tags the system will do something (light a green LED for a moment). Plus we have another LED which stays on unless an allowed tag is read.  Wire up the hardware as shown below (LED1 is red, LED2 is green – click image to enlarge):

Now enter and upload the following sketch:

In the function readCard() the sketch reads the tag data from the ID-20, and stores it in an array testtag[]. The index is -1 so the first unwanted tag number isn’t stored in the array. Once thirteen numbers have come through (the one we don’t want plus the twelve we do want) the numbers are smooshed together into a string variable testcard with the function String. Now the testcard string (the tag just read) can be compared against the three pre-stored tags (Sinclair, Smythe and Stephen).

Then it’s simple if… then… else to to see if we have a match, and if so – call the function approved() or disApproved as the case may be. In those two functions you store the actions you want to occur when the correct card is read (for example, control a door strike or let a cookie jar open) or when the system is waiting for another card/a match can’t be found. If you’re curious to see it work, check the following video where we take it for a test run and also show the distances that you have to work with:

Hopefully this short tutorial was of interest. We haven’t explored every minute detail of the reader – but you now have the framework to move forward with your own projects.

LEDborder

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, id12, id20, innovations, lesson, PRT-00553, rfid, RFR103B2B, SEN-08419, SEN-08423, SEN-08628, tutorial, wireless19 Comments

RF Wireless Data with the Seeedstudio RFbee

Introduction

In this article we examine the Seeedstudio RFbee Wireless Data Transceiver nodes. An RFbee is a small wireless data transceiver that can be used as a wireless data bridge in pairs, as well as a node in mesh networking or data broadcasting. Here is an example of an RFbee:

You may have noticed that the RFbee looks similar to the Xbee-style data transceivers – and it is, in physical size and some pinouts, for example:

comparison

However this is where the similarity ends. The RFbee is in fact a small Arduino-compatible development board based on the Atmel ATmega168 microprocessor (3.3V at 8MHz – more on this later) and uses a Texas Instruments CC1101 low-power sub1-GHz RF transceiver chip for wireless transfer. Turning over an RFbee reveals this and more:

But don’t let all this worry you, the RFbee is very simple to use once connected. As a transceiver the following specifications apply:

  • Data rate – 9600, 19200, 38400 or 115200bps
  • Adjustable transmission power in stages between -30dBm and 10 dBm
  • Operating frequency switchable between 868MHz and 915MHz
  • Data transmission can be point-to-point, or broadcast point-to-many
  • Maximum of 256 RFbees can operate in one mesh network
  • draws only 19.3mA whilst transmitting at full power

The pinout for the RFbee are similar to those of an Xbee for power and data, for example:

There is also the ICSP pins if you need to reprogram the ATmega168 direcly with an AVRISP-type programmer.

Getting Started

Getting started is simple – RFbees ship with firmware which allows them to simply send and receive data at 9600bps with full power. You are going to need two or more RFbees, as they can only communicate with their own kind. However any microcontroller with a UART can be used with RFbees – just connect 3.3V, GND, and the microcontroller’s UART TX and RX to the RFbee and you’re away. For our examples we will be using Arduino-compatible boards. If Arduino is new to you, consider our tutorials first.

If you ever need to update the firmware, or reset the RFbee to factory default after some wayward experimenting – download the firmware which is in the form of an Arduino sketch (RFBee_v1_1.pde) which can be downloaded from the repository. (This has been tested with Arduino v23). In the Arduino IDE, set the board type to “Arduino Pro or Pro Mini (3.3V, 8MHz) w/ATmega168″. From a hardware perspective, the easiest way to update the firmware is via a 3.3V FTDI cable or an UartSBee board, such as:

xbs4

You will also find a USB interface useful for controlling your RFbee via a PC or configuration (see below). In order to do this,  you will need some basic terminal software. A favourite and simple example is called … “Terminal“. (Please donate to the author for their efforts).

Initial Testing

After connecting your RFbee to a PC, run your terminal software and set it for 9600 bps – 8 – None – no handshaking, and click the check box next to “+CR”. For example:

term1

Select your COM: port (or click “ReScan” to find it) and then “Connect”. After a moment “OK” should appear in the received text area. Now, get yourself an Arduino or compatible board of some sort that has the LED on D13 (or substitute your own) and upload the following sketch:

Finally, connect the Arduino board to an RFbee in this manner:

  • Arduino D0 to RFbee TX
  • Arduino D1 to RFbee RX
  • Arduino 3.3V to RFbee Vcc
  • Arduino GND to RFbee GND
and the other RFbee to your PC and check it is connected using the terminal software described earlier. Now check the terminal is communicating with the PC-end RFbee, and then send the character ‘A’, ‘B’ or ‘C’. Note that the LED on the Arduino board will blink one, two or three times respectively – or five times if another character is received. It then reports back “Blinking completed!” to the host PC. For example (click to enlarge):
term2

Although that was a very simple demonstration, in doing so you can prove that your RFbees are working and can send and receive serial data. If you need more than basic data transmission, it would be wise to get a pair of RFbees to experiment with before committing to a project, to ensure you are confident they will solve your problem.

More Control

If you are looking to use your RFbees in a more detailed way than just sending data at 9600 bps at full power, you will need to  control and alter the parameters of your RFbees using the terminal software and simple AT-style commands. If you have not already done so, download and review the RFbee data sheet downloadable from the “Resources” section of this page. You can use the AT commands to easily change the data speed, power output (to reduce current draw), change the frequency, set transmission mode (one way or transceive) and more.

Reading and writing AT commands is simple, however at first you need to switch the RFbee into ‘command mode’ by sending +++ to it. (When sending +++ or AT commands, each must be followed with a carriage return (ASCII 13)). Then you can send commands or read parameter status. To send a command, just send AT then the command then the parameter. For example, to set the data rate (page ten of the data sheet) to 115200 bps, send ATBD3 and the RFbee will respond with OK.

You can again use the terminal software to easily send and receive the commands. To switch the RFbee from command mode back to normal data mode, use ATO0 (that’s AT then the letter O then zero) or power-cycle the RFbee.

RFbee as an Arduino-compatible board with inbuilt wireless

As mentioned previously the RFbee is based around an Atmel ATmega168 running at 8MHz with the Arduino bootloader. In other words, we have a tiny Arduino-compatible board in there to do our bidding. If you are unfamiliar with the Arduino system please see the tutorials listed here. However there are a couple of limitations to note – you will need an external USB-serial interface (as noted in Getting Started above), and not all the standard Arduino-type pins are available. Please review page four of the data sheet to see which RFbee pins match up to which Arduino pins.

If for some reason you just want to use your RFbee as an Arduino-compatible board, you can do so. However if you upload your own sketch you will lose the wireless capability. To restore your RFbee follow the instructions in Getting Started above.

The firmware that allows data transmission is also an Arduino sketch. So if you need to include RF operation in your sketch, first use a copy of the RFBee_v1_1.pde included in the repository – with all the included files. Then save this somewhere else under a different name, then work your code into the main sketch. To save you the effort you can download a fresh set of files which are used for our demonstration. But before moving forward, we need to learn about controlling data flow and device addresses…

Controlling data flow

As mentioned previously, each RFbee can have it’s own numerical address which falls between zero and 255. Giving each RFbee an address allows you to select which RFbee to exchange data with when there is more than two in the area. This is ideal for remote control and sensing applications, or to create a group of autonomous robots that can poll each other for status and so on.

To enable this method of communication in a simple form several things need to be done. First, you set the address of each RFbee with the AT command ATMAx (x=address). Then set each RFbee with ATOF2. This causes data transmitted to be formatted in a certain method – you send a byte which is the address of the transmitting RFbee, then another byte which is the address of the intended receipient RFbee, then follow with the data to send. Finally send command ATAC2 – which enables address checking between RFbees. Data is then sent using the command

Where data is … the data to send. You can send a single byte, or an array of bytes. length is the number of bytes you are sending. sourceAddress and destinationAddress are relevant to the RFbees being used – you set these addresses using the ATMAx described earlier in this section.

If you open the file rfbeewireless.pde in the download bundle, scroll to the end of the sketch which contains the following code:

This is a simple example of sending data out from the RFbee. The RFbee with this sketch (address 1) sends the array of bytes (testdata[]) to another RFbee with address 2.  You can disable address checking by a receiving RFbee with ATAC0 – then it will receive any data send by other RFbees.

To receive data use the following function:

The variable result will hold the incoming data, len is the number of bytes to expect, sourceAddress and destinationAddress are the source (transmitting RFbee) and destination addresses (receiving RFbee). rssi and lqi are the signal strength and link quality indicator – see the TI CC1101 datasheet for more information about these. By using more than two RFbees set with addresses you can selectively send and receive data between devices or control them remotely. Finally, please note that RFbees are still capable of sending and receiving data via the TX/RX pins as long as the sketch is not executing the sendTestData() loop.

I hope you found this introduction interesting and useful. The RFbees are an inexpensive and useful alternative to the popular Xbee modules and with the addition of the Arduino-compatible board certainly useful for portable devices, remote sensor applications or other data-gathering exercises.

For more information and product support, visit the Seeedstudio product pages.

RFbees are available from Seeedstudio and their network of distributors.

Disclaimer - RFbee products used in this article are promotional considerations made available by Seeedstudio.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, education, lesson, RF, rfbee, seeedstudio, tutorial, wireless, WLS126E1P, xbee

Product Announcement: The Zigduino

Hello readers

Recently the people at Logos Electromechanical have announced their new product – the Zigduino.

The Zigduino is an Arduino-compatible microcontroller platform that integrates an 802.15.4 radio on the board. The radio can be configured to support any 802.15.4-based protocol, including ZigBeeRoute Under MAC/6LoWPAN, and RF4CE. It uses a reverse polarity SMA connector (RP-SMA) for an external antenna. This allows the user to use nearly any existing 2.4 GHz antenna with it. The Zigduino runs on 3.3V, but all I/O pins are 5V compatible.

Pictured below is a production Zigduino kit with all components:

Thankfully all that SMD word is done for you. The only soldering required is the aerial socket, Arduino headers and the DC socket. All the components shown in the image above are included with purchase. The Zigduino specifications include (from the website):

Microcontroller Atmega128RFA1
Operating Voltage 3.3V
Input Voltage (recommended) 7-18V
Input Voltage (maximum) 6-30V (transients to -20V and +60V)
Digital I/O Pins 14 + 3 auxiliary
PWM Output Pins 6
Analog Input Pins 6 (0-1.8V)
I/O Protection ±30V transient
-2.5V to +5.8V continuous
DC Current per I/O Pin 20 mA
DC Current for 5V Pin 250 mA
DC Current for 3.3V Pin 200 mA
Flash Memory 128 KB of which 2 KB is used by the bootloader
SRAM 16 KB
EEPROM 4 KB
Clock Speed 16 MHz
RF transmit power +3.5 dBm
Receiver sensitivity -100 dB
Antenna gain 2 dBi
Current Draw 30 mA (transmitting, USB, no I/O connections)
15 mA (transmitting, no USB, no I/O connections)
6 mA (radio off, no USB, no I/O connections)
250 μA (sleep)

Compatibility

  • Compatible with any shield that supports 3.3V logic
  • Compatible with existing Arduino libraries that do not use hard-coded pin definitions
  • Compatible with Arduino IDE with updated compiler, avr-gcc-4.3.3 or later.

Software

Power

The Zigduino can be powered through the USB connection or with an external power supply. The power source with the highest voltage is selected automatically.

External power can be supplied via a wall wart or a battery. It can be connected with a 2.1mm center-positive plug inserted into the power jack. Alternately, external power can be connected through the GND and VIN pins of the POWER header.

The board will operate correctly on an input voltage between 6V and 30V. It will survive transients as large as -20V or +60V. However, higher supply voltages may cause excessive heat dissipation at higher current draws. The input voltage regulator has integral overtemperature protection, so you can’t permanently damage the board this way. However, the board may not work correctly under these circumstances.

The power pins are as follows:

  • VIN – The input voltage to the Arduino board when it is running from external power, i.e. not USB bus power.
  • 5V – The regulated 5V used to power 5V components on the board and external 5V shields. It comes either from the USB or from the VIN via the 5V regulator. Maximum current draw is 250 mA.
  • 3V3 – The regulated 3.3V supply that powers the microcontroller. It is derived from the 5V bus via a second regulator. Maximum current draw is 200 mA.
  • GND – Ground pins.

Memory

The ATmega128RFA1 has 128 KB of flash memory, of which 2 KB is occupied by the bootloader. It also has 16 KB of SRAM (the most of any Arduino-compatible board) and 4 KB of EEPROM, which can be accessed through the EEPROM library.

Input and Output

Each of the 14 digital pins of the Zigduino can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead(). Each pin operates at 3.3V and can source or sink 10 mA. Each also has an internal pullup, which is disabled by default. Each pin is protected against ±30V spikes and can tolerate continuous 5V input.

The six analog input pins, labeled A0 – A5, are likewise protected against ±30V spikes and can tolerate continuous 5V input. Each provides 10 bits of resolution and measures 0 – 1.8V. It is possible to change to a lower top voltage through use of the AREF pin and the analogReference() function.

A key design goal of the Zigduino is maintaining compatibility with existing shields to the greatest extent possible. The ATmega128RFA1′s peripherals are arranged slightly differently than the corresponding peripherals on the ATmega328 used in the stock Arduino. Therefore, in order to provide the desired shield compatibility, there are three solder jumpers provided on the back of the board. They function as follows:

  • Digital pin 11 can be set as either SPI MOSI or a PWM output. Neither option is selected as shipped. SPI MOSI is also available on the SPI connector at all times along with SCK and MISO.
  • Analog pin 4 can be set as either A4 or I2C SDA. Neither option is selected as shipped. Both I2C pins are available on the I2C connector.
  • Analog pin 5 can be set as either A4 or I2C SCL. Neither option is selected as shipped. Both I2C pins are available on the I2C connector.

The following additional special functions are available:

  • Serial: 0 (RX) and 1 (TX) – Used to transmit and receive TTL serial data. These pins are connected to the corresponding pins on the FTDI USB interface chip.
  • PWM: 3, 5, 6, 9, 10, and 11 – Provides 8-bit PWM output with the analogWrite() function. Pin 11 must be selected for PWM operation with the solder jumper on the back of the board.
  • SPI: 11 (MOSI), 12 (MISO), 13 (SCK) – These pins support SPI communications using the SPI library. Pin 11 must be selected for SPI operation with the solder jumper on the back, or SPI must be accessed with the SPI connector.
  • LED: 13 – This is the built-in LED on digital pin 13. When the pin is high, the LED is on.
  • External Interrupts: 2, 3, 6, and 7 – These pins can be configured to trigger and interrupt on a low value, high value, or an edge. See the attachInterrupt() function for details. The two I2C pins can also be used as interrupts.
  • I2C: A4 (SDA) and A5 (SCL) – These pins support I2C communications using the Wire library. They must be selected for I2C operation with the jumpers on the back or I2C must be accessed through the I2C connector. They can also be configured as interrupts.

This is one very capable Arduino-compatible board and sure to find many uses. For updates and new ideas consider following the Logos Electromechanical blog page.  Furthermore associated Zigduino files can be found on Github.

So if you are looking to expand into the world of personal-area networks, Zigbee wireless and so on –  you could do very well by considering a Zigduino or two. For more information, questions, support, and to purchase visit the product website, Seeed Studio or lipoly.de

Posted in 802.15.4, arduino, Atmega128RFA1, review, wireless, xbee, zigduino

Review – Starman Electric Databridge Wireless I/O Modules

In this review we are going to have a look at some new wireless data modules that have just arrived on the market. They are the Databridge Wireless I/O modules from Starman Electric. Although there are many types of wireless modules out there, such as the discount 315 MHz units that are somewhat unreliable (well for me); and the great XBee series (as we used in Moving Forward with Arduino – Chapter Fourteen) – these Starman modules take it to the next level. How?

The concept of a databridge is a delightfully simple one. The two modules take the place of a wire. Digital, analogue, UART, even PC serial. No firmware settings to adjust, just plug them in and they work!

First of all, there are two physical types of unit, either DIP mount or SMD. The units below are the DIP version, 1mW output power:

topss1

The graph paper is 5mm square, and the module measures 53.85mm by 25.91mm. The DIP packaging (above) is meant for experimenters and prototypes, you can order SMD versions for production runs. There are also two power-output versions, 1mW with a theoretical range of 1km, and a 100 mW with a range of 4km. The higher power modules require the use of an external antenna. They require 3.3 volts DC, with a peak current draw of 37mA for the 1mW, and 120mA for the 100mW. For demonstration purposes I am using a Texas Instruments LP2950 to provide 3.3 volts DC at up to 100 mA.

Although the specification sheet is quite long (and you can download it from here) there are a few features that really stand out, including:

  • Automatic connection – a pair of modules will ‘lock’ onto each other without any extra work by the user;
  • A very high sampling rate of 200 samples per second with a latency of five millisconds;
  • Spread-spectrum radio operation – the modules will skip frequencies themselves for reliable connections;
  • You can have sixteen unique pairs working in the same area without cross-interference;
  • You can have two analogue channels and multiple digital channels simultaneously.

But enough talking, time to put them to the test. I will recreate some examples found in the Getting Started manual available for download here.

As I only have one pair of modules, and somehow I think my neighbours won’t be using any at this point in time, there is no need to set the pair’s unique network ID. However you do need to specify the master and slave in the module relationship (no switches…), which is done with pin 4 – to Vcc for master, and pin 4 to GND for slave. Now on with the show!

The first example of interest is number two in the guide – the wireless digital and analogue I/O bridge. To me this seems like an interesting wireless “repeater” to some Arduino analogue and digital outputs. Here is my test schematic used for the demonstrations in this review:

schematicss4

and my usual messy breadboards:
bboardss

Well this is a temporary test! The slave module board is running from a 9V PP3 battery so I can take it for a walk.

Anyhow, the setup is – four digital out lines from an Arduino, which are either high or low (+5v or GND). These are connected to pins ‘digital signal’ 1~4 on the master Databridge. Furthermore, Arduino analogue pin 1 went to the Databridge ‘analog signal’ pin 1. At the slave side of things, there are four LEDs with current limiting resistors connected to pins ‘digital signal’ 1~4; and two wires each from ‘analog signal’ 1 would be connected to a voltmeter. The digital output pins on slave modules default to ‘high’ unless driven otherwise.

Finally, there is also an LED and current limiting resistor coming from pin 32 of each unit – the ‘link’ pin. The link pin is a lifesaver. Here is a great feature – when the pair of units are within range of each other and matched as a pair, link goes high (3.3V). Out of range? It goes low (0V). Therefore you can test the range on these modules just by powering them up on a breadboard each, with the LEDs on pin 32, and go for a walk with a unit. When the LED is off – you’re out of range. And when you come back into range, the modules reconnect automatically.

Back to the test. First I just created a loop which turned the digital pins on and off, and the matching LEDs on the slave unit blinked on and off as expected. No extra code, no trying to create wacky functions to multiplex/demultiplex signals – this just works. The modules are like an invisible bunch of wires between two points. Never has anything wireless worked so easily for me.

Here is a quick video clip, first notice the lonely LEDs on each breadboard – the are the link LEDs. When I power cycle the master or slave, notice how quickly they reconnect. Please note that the slave unit retains the state of the digital outputs if connection is lost. So if a pin is high while connected – if the module loses radio contact, the pin will stay high.

The theoretical maximum working range is quoted as 1km for these 1mW modules. My indoor test allowed a distance of 11 metres, with three concrete walls of a thickness of ~110mm in between. Unfortunately living in my area I could not find a flat, open area large enough to test the maximum open-air range – however considering the indoor ‘concrete wall’ test and my experience with other wireless equipment of this power output, it would be accurate in an outdoor, line-of-sight application. As always, conduct your own real-life tests before making any project commitments  and so on.

And as always, I was curious about the current draw of the units while in use. The master module with the link LED on measured 53 milliamps, with the slave at the boundary of the radio range:

macurrss

The current use only dropped around 2 or 3 milliamps when the slave was next to the master. The slave module used 59 milliamps with the link LED on:

slcurrss

Therefore taking the LED current draw into consideration, the power usage of these modules is quite low considering the level of communication between them and the high sampling rate.

The next test was to see how the analogue data lines performed. According to example four in the Getting Started guide, the modules will reproduce an input of between 0 and 2.4 volts DC. So I have placed an 11k ohm resistor in series with a 10k ohm potentiometer with analog input 1, and measured the resulting output from the slave. Notice how I still have the digital data lines in use while using the analogue line.  Here is a short clip of this in action:

Amazing – a multitasking wireless module. Note that you could always use an op-amp to boost the output voltage back to the 0~5V DC range, an example of this is on page nine of the Getting Started guide.

Those above were but two from the many possibilities available when using these units:

  • wireless serial data links
  • remote on/off control of six items
  • robotics remote control
  • microcontroller I/O wireless extension…

Frankly – if you need to wirelessly connect more than one data line simultaneously, you have an excellent solution with the Databridge modules.

Update! – Radio licensing information:

These modules operate in the 2.4 GHz ISM (industrial, scientific and medical) band. For those in the USA, the Databridge is an FCC-approved “class B” device, and is only for use by OEM integrators (see page 16 of the datasheet.pdf). Starman Electric also state that the Databridge is certified for Canada and the EU (ETSI).

For those here in Australia, these units are operated under the conditions of the Radiocommunications (Low Interference Potential Devices) Class Licence 2000, and I feel are classed as “spread spectrum unit” under the preceding license.

Please conduct your own research with regards to radio transmitter licensing in your area. Furthermore, please read the tronixstuff “boring stuff” here.

But enough about that, where you can get them?

Australian customers can purchase these modules from our local distributor - Interworld Electronics; North Americans and the rest of the world directly via Starman Electric.

Remember, if you have any questions about these modules please contact Starman Electric via their website.

[Note - these wireless modules were loan units received from Starman Electric for review purposes]

Posted in databridge, part review, starman, wireless8 Comments

Moving Forward with Arduino – Chapter 14 – XBee introduction

Learn how to use XBee wireless data transceivers with Arduino. This is part of a series originally titled “Getting Started with Arduino!” by John Boxall – A tutorial on the Arduino universe. The first chapter is here, the complete series is detailed here.

Updated 02/03/2013

We will examine the Series 1 XBee wireless data transceivers from Digi in the USA. Although in the past we have experimented with the inexpensive 315MHz transmit/receive pair modules (chapter 11), they have been somewhat low in range and slow with data transmission. The XBee system changes this for the better.

First of all, what is an Xbee module? It is a very small piece of hardware that can connect wirelessly with another using the Zigbee communication protocols. There are many different models, including aerial types and power outputs. In this tutorial we’re using Series One XBees.

From Wikipedia, Zigbee is:

ZigBee is a specification for a suite of high level communication protocols using small, low-power digital radios based on the IEEE 802.15.4-2003 standard for wireless home area networks (WHANs), such as wireless light switches with lamps, electrical meters with in-home-displays, consumer electronics equipment via short-range radio. The technology defined by the ZigBee specification is intended to be simpler and less expensive than other WPANs, such as Bluetooth. ZigBee is targeted at radio-frequency (RF) applications that require a low data rate, long battery life, and secure networking.

Phew. For this chapter I will try and keep things as simple as possible to start off with. Here is an image of a typical Xbee unit:

Note that the pin spacing is small than 2.54mm, so you cannot just drop these into a breadboard. However for the purposes of our experimenting more equipment is needed. Therefore I am making use of this retail package from Sparkfun:

xbeeretailpackopenedsmall

This bundle includes two Xbee modules, an Xbee shield to connect one of the modules to an Arduino Uno-style board. When it comes time to solder the sockets into your shield, the best way is to insert them into another shield that is upside down, then drop the new shield on top and solder. For example:

solder2s

Finally, the bundle also includes a USB Explorer board, which allows us to connect one Xbee to a personal computer. This allows us to display serial data received by the Xbee using terminal software on the PC. One can also adjust certain Xbee hardware parameters by using the explorer board such software.

Let’s do that now. You will need some terminal software loaded on your computer. For example, Hyperterminal or Realterm. Plug an Xbee into the explorer board, and that into your PC via a USB cable. Determine which port (for example COM2:) it is using with your operating system, then create a new terminal connection. Set he connection to 9600 speed, 8 bits, no parity, 1 stop bit and hardware flow control. For example, in Hyperterminal this would look like:

Once you have established the connection, press “+++” (that is, plus three times, don’t press enter) and wait. The terminal screen should display “OK”. This means you are in the XBee configuration mode, where we can check the settings and change some parameters of the module. Enter “ATID” and press enter. The terminal window should display a four-digit number, which is the network ID of the module. It should be set by default to 3332. Unless you plan on creating a huge mesh network anytime soon, leave it be. To be sure your modules will talk to each other, repeat this process with your other XBee and make sure it also returns 3332. However as this is the default value, they should be fine.

Now for our first example of data transmission, insert one Xbee into the explorer module, and the other into the Xbee shield. With regards to the Xbee shield – whenever it is connected to an Arduino board and you about to upload a sketch, look for a tiny switch and change it to DLINE from UART. Don’t forget to change it back after uploading the sketch. See:

shieldswitchss

We are going to use the two Xbee modules as a straight, one-way serial line. That is, send some data out of the TX pin on the transmit board, and receive it into the terminal on the PC. Now upload this sketch into your Arduino board. This is a simple sketch, it just sends numbers out via the serial output. Then set the switch on the shield back to UART, and reset the board. If you can, run this board on external power and put it away from the desk, to give you the feeling that this is working :)

Note: More often that not one can purchase AC plug packs that have USB sockets in them, for charging fruity music players, and so on.

acusbss

Or you might have received one as a mobile phone charger. These are great for powering Arduino boards without using a PC. Now ensure your explorer module is plugged in, and use the terminal software to connect to the port the explorer is plugged into. After connecting, you should be presented with a scrolling list of numbers from 0 to 99, as per example 14.1 sketch:

numbers

How did you go? Sometimes I used to get the COM: ports mixed up on the PC, so that is something to keep track of. If you are powering both Xbees from your PC using USB cables, double-check the terminal software is looking at the explorer board, as an Arduino transmitting serial data through an Xbee shield will still send the same data back to the PC via USB.

Now that we have sent data in one direction, we can start to harness the true power of Xbees – they are transceivers, i.e. send and receive data. Next, we’ll create an on-demand temperature and light-level sensor. Our arduino board will have a temperature sensor and a light-dependent resistor, and using the terminal on the computer, we can request a temperature or light-level reading from the remote board. More about temperature sensors in chapter two. First of all, the remote board hardware setup:

exam14p2boardss

… and the schematic:

exam14p2schemss

 

It never hurts to elevate your other Xbee:

xbeewallss

For the PC side of things, use the explorer board and USB cable. Here is the sketch. It is quite simple. The remote board ‘listens’ to its serial in line. If it receives a “1″, it reads the temperature, converts it to Celsius and Fahrenheit, and writes the result to its serial out line, which is sent over our Xbee data bridge and received by the host computer. A “2″ will result in the analogue value of the photocell to be sent back as a “light level”. Once again we use the terminal software to control the system.  Here is a quick video of the terminal in action:

The speed is quite good, almost instantaneous. By now hopefully you can see how easy it is to end some data backwards and forwards over the ether. The range is only limited by the obstacles between the Xbee transceivers and the particular power output of each model. With example 14.2, there were two double-brick walls between them. Furthermore, we can build fully computer-independent systems that can talk to each other, such as more portable remote controls, or other data-gathering systems. In the next few chapters, sooner rather than later.

LEDborder

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, learning electronics, lesson, microcontrollers, RTL-11445, tutorial, wireless, WRL-09819, WRL-11215, xbee10 Comments

Getting Started with Arduino – Chapter Thirteen

This is part of a series titled “Getting Started with Arduino!” by John Boxall – A tutorial on the Arduino universe. The first chapter is here, the complete series is detailed here.

Welcome back fellow arduidans!

This chapter we will examine piezo buzzers, continue with our alarm clock, and then spend more time with the wireless radio modules by creating some remote control systems and sending various data over the airwaves. So let’s go!

Sometimes you would like to make some noise. For warnings, fun, or to annoy people. A very simple and inexpensive way to do this is with a piezoelectric buzzer. In simple terms, it contains a disc of metal that can deform when a current is applied to it. If you apply an alternating current at a high enough frequency, the disc will move fast enough to create a sound wave, something we can hear.

This is an example of a small piezo buzzer:

tdk_ps1240ss

This example was very cheap, less than $2.  Here is the data sheet: PS1240.pdf. It can run from between 3 and 30 volts AC – which thankfully the output from our Arduino falls between. But how do you output AC from an Arduino? There are several ways, however the easiest is using pulse-width modulation (PWM). If you look at your Arduino’s digital output sockets, some are labelled PWM. Using the function analogWrite(); you can send a PWM signal to the buzzer. For example:

The sketch above will beep the piezo on and off, and be somewhat annoying. Perfect. However with the analogWrite(); function it is impossible to use the full frequency range of the piezo buzzer. With a value of 254 for the duty cycle, the frequency generated is around 1500 Hz:

ps1240_analogwrite254ss

Later on we will explore ways to create a better range of sounds. But now to use that buzzer in our alarm clock to help wake people up.

Continuing on from exercise 12.1, this chapter we will add some more features to the clock. First of all is the piezo buzzer. As we just discussed above, using it is quite simple. On the hardware side of things, we can replace the resistor and LED connected between digital pin 6 and ground with our piezo buzzer. On the software side of things, instead of digitalWrite(6, HIGH); we use analogWrite(6,128);. Very easy. And here is a short video – with sound!

Moving on, it’s time to clean up the alarm function in general. Most alarm clocks have a snooze function, so let’s add one as well. When the alarm sounds, the user presses button four to turn off the buzzer, and is then asked if they want to snooze. Button one is yes and four is no. If yes, add ten minutes to the alarm time and carry on as normal. When adding the ten minutes be sure to check for increasing the hour as well, and also take into account the jump from 2359h to 0000h (or 2400h). If the user presses no, the alarm is switched off and the user warned with the flashing “OFF”.

Example 13.1Here is a demonstration of what I came up with:

The hardware is the same as exercise 12.1, except the LED and resistor from digital pin 6 to GND has been replaced by the piezo buzzer as described earlier. You will find the snooze function is controlled in the checkalarm(); function in the sketch.

 

In chapter eleven we started to examine the inexpensive serial data transmitter/receiver pairs. In this chapter we will continue working with them, to create the backbone of various remote control and data transmission ideas for you to use. For our next example, consider a simple remote control with four channels. That is, it has four buttons, and the transmitter will send out the state of the four buttons, high or low.

This would be useful for a remote control toy or a perhaps robot. The sketches are quite simple. The transmitter reads the buttons with digitalRead(); then transmits a single letter a~h – which is code for a button and its state. For example, a means button 1 is low, h means button 4 is high. The receiver just decodes that a~h code and sends the result to the serial monitor window. Here is the sketch for the transmitter and receiver.

To save time I will use the button board created in example 12.3. Here are the schematics for the transmitter and receiver sections:

example13p2schemss

And set up:

example13p2ss

And finally a video of the serial monitor showing the button states:

Now that we have the data being sent across, let’s get some switching happening. Using the same transmitter system as example 13.2, we will turn on or off four LEDs at the receiving end. Of course you could use relays, transistors, 74HC4066s, etc instead. Our sketch decodes the transmitted data once more, but sets the digital pins high or low depending on the received code. Here is the schematic for the new receiver:

example13p2schemss

… and the board laid out:

example13p3boardss

And again a quick demonstration video:

Now that you can turn the LEDs on or off with a push of a button, there are a few other ways of controlling those digital outputs with the remote control rig without altering the hardware.

For out next example, we will control two digital outputs with the four buttons, as each output will have an on and off button. Consider this sketch; and the following demonstration video:

So there you have various ways to control digital outputs and send basic data across a wireless radio serial data link.

LEDborder

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in 315 MHz, 433 MHz, arduino, education, learning electronics, lesson, microcontrollers, piezo, tutorial, wireless12 Comments


Receive notifications of new posts by email.

The Arduino Book

Arduino Workshop

Für unsere deutschen Freunde

Dla naszych polskich przyjaciół ...

Australian Electronics!

Buy and support Silicon Chip - Australia's only Electronics Magazine.

Use of our content…

%d bloggers like this: