SMD Soldering made easier

Hooray – we’re back…

SMD (surface mount device) soldering to some people can seem scary and dangerous. And if done incorrectly, or in the wrong state of mind, and/or with the wrong equipment – it can be. Or like myself, you could be pretty bad at it. To make things easier, I’d like to point you in a few directions to find help and guidance if this technique is new to you. 

First up we have a new comic from Greg Peek and Dave Roberts from siliconfarmers.com, (written in a similar vein to the “Soldering is Easy” comic that was released in 2010) that is easy to read and makes sense. Here is the cover:

As you can see from the CC logo on the title page, the comic is in the public domain, so please print it out, email it, and generally distribute it far and wide. For more information about the authors see their website at siliconfarmers.com. I have also placed the files here at tronixstuff for you to download.

Next we have a detailed and nicely illustrated tutorial by Jon Oxer from freetronics.

Jon runs through the process of soldering with a toaster over, with great success. So head over and have a read.

For the first video tutorial we have the SMD episide of the series by David L. Jones at eevblog, well worth the time:

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.

Advertisements
By John Boxall

April 2012 Competition Results

April is well and truly over so time to announce the results of our April 2012 Competition!

The winner of the First Prize is Michael F from Germany who will receive a new Freetronics DMD – Dot Matrix Display as reviewed recently and used in Clock One:

The DMD consists of 16 rows of 32 LEDs that can run directly from an Arduino-compatible board, or at a much higher brightness using an external power supply. It is simple to program for yet a load of fun to use. Specifications include:

  • 32 x 16 high brightness Red LEDs (512 LEDs total) on a 10mm pitch
  • 5V operation
  • Viewable over 12 metres away
  • Tough plastic frame
  • Controller ICs on board, simple clocked data interface
  • Arduino compatible library, graphics functions and example support
  • Dimensions: 320(W) x 160(H) x 14(D)mm (30mm(D) including rear connectors)

DMDs are also available in blue, as shown below:

The winner of the Second Prize is Hendrik from Germany (!) who will receive one each of the eleven modules from the Freetronics Module/Sensor range, as reviewed recently:

With this range of modules you will be able to sense temperature, humidity, magnetic fields, light and sound pressure levels, sound and shock. Plus light up with the RGB LED, get more I/O with the expansion module, interface with the level shifter board, control high currents with the N-MOSFET, and power the lot with the tiny switch mode power supply. Available from Freetronics or a reseller near you.

For the curious, the questions and answers were:

  1. Name three HP calculators that use LED displays – There are many. Just scroll through the list available here.
  2. What does CPLD stand for? Complex programmable logic device. (Why CPLD? We were going to review some CPLD gear but it didn’t work out)
  3. In which year was Tektronix founded? 1946.
  4. Which company introduced the term “numitron”? RCA.
  5. Which company invented Bluetooth? Ericsson.

Thanks to Freetronics for the prizes!

In the meanwhile, 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.

 

By John Boxall

Arduino, Android and Seeedstudio Bluetooth Bee

Introduction

In this article we examine the Seeedstudio ”Bluetooth Bee“ modules and how they can be used in a simple way in conjunction with Android devices to control the Arduino world.  Here is an example of a Bluetooth Bee:

For the curious, the hardware specifications are as follows:

  • Typical -80dBm sensitivity
  • Up to +4dBm RF transmit power
  • Fully Qualified Bluetooth V2.0+EDR 3Mbps Modulation
  • Low Power 1.8V Operation, 1.8 to 3.6V I/O
  • UART interface with programmable baud rate
  • Integrated PCB antenna.
  • XBee compatible headers

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

The neat thing with the BtB (Bluetooth Bee) is that it is compatible with Xbee sockets and Arduino shields. It is a 3.3V device and has the same pinouts for Vcc, GND, TX and RX – so an existing Xbee shield will work just fine.

In some situations you may want to use your BtB on one UART and have another for debugging or other data transport from an Arduino – which means the need for a software serial port. To do this you can get a “Bees Shield” which allows for two ‘Bee format transceivers on one board, which also has jumpers to select software serial pins for one of them. For example:

Although not the smallest, the Bees Shield proves very useful for experimenting and busy wireless data transmit/receive systems. More about the Bees Shield can be found on their product wiki.

Quick Start 

 In the past many people have told me that bluetooth connectivity has been too difficult or expensive to work with. In this article I want to make things as simple as possible, allowing you to just move forward with your ideas and projects. One very useful function is to control an Arduino-compatible board with an Android-based mobile phone that has Bluetooth connectivity. Using the BtB we can create a wireless serial text bridge between the phone and the Arduino, allowing control and data transmission between the two.

We do this by using a terminal application on the Android device – for our examples we will be using “BlueTerm” which can be downloaded from Google Play – search for “blueterm” as shown below:

In our Quick Start example, we will create a system where we can turn on or off four Arduino digital output pins from D4~D7. (If you are unsure about how to program an Arduino, please consider this short series of tutorials). The BtB is connected using the Bees shield. This is based on the demonstration sketch made available on the BtB Wiki page – we will use commands from the terminal on the Android device to control the Arduino board, which will then return back status.

Question – Which company invented Bluetooth?

As the BtB transmit and receive serial data we will have it ‘listen’ to the virtual serial port on pins 9 and 10 for incoming characters. Using a switch…case function it then makes decisions based on the incoming character. You can download the sketch from here. It is written for Arduino v23. If you were to modify this sketch for your own use, study the void loop() section to see how the incoming data is interpreted, and how data is sent back to the Android terminal using blueToothSerial.println

/* BluetoothBee Demo Code - Flowcontrol Based Implementation 2010,2011 Copyright (c) Seeed Technology Inc. All right reserved.  Author: Visweswara R Modified: John Boxall, April 2012  This demo code is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.  You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA  For more details about the product please check http://www.seeedstudio.com/depot/  */
#include <NewSoftSerial.h> //Software Serial Port #define RxD 9 #define TxD 10 #define DEBUG_ENABLED 1
NewSoftSerial blueToothSerial(RxD,TxD); char incoming;
void setup() { pinMode(RxD, INPUT); pinMode(TxD, OUTPUT); setupBlueToothConnection(); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(7, OUTPUT);
}
void setupBlueToothConnection() { blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400 delay(1000); sendBlueToothCommand("\r\n+STWMOD=0\r\n"); sendBlueToothCommand("\r\n+STNA=SeeeduinoBluetooth\r\n"); sendBlueToothCommand("\r\n+STAUTO=0\r\n"); sendBlueToothCommand("\r\n+STOAUT=1\r\n"); sendBlueToothCommand("\r\n +STPIN=0000\r\n"); delay(2000); // This delay is required. sendBlueToothCommand("\r\n+INQ=1\r\n"); delay(2000); // This delay is required. }
//Checks if the response "OK" is received void CheckOK() { char a,b; while(1) { if(blueToothSerial.available()) { a = blueToothSerial.read();
if('O' == a) { // Wait for next character K. available() is required in some cases, as K is not immediately available. while(blueToothSerial.available()) { b = blueToothSerial.read(); break; } if('K' == b) { break; } } } }
while( (a = blueToothSerial.read()) != -1) { //Wait until all other response chars are received } }
void sendBlueToothCommand(char command[]) { blueToothSerial.print(command); CheckOK(); }
void loop() { // get character sent from Android device incoming=blueToothSerial.read(); // decide what to do with it switch (incoming) { case '1': digitalWrite(4, HIGH); blueToothSerial.println("pin 4 HIGH"); break;
case '2': digitalWrite(5, HIGH); blueToothSerial.println("pin 5 HIGH"); break;
case '3': digitalWrite(6, HIGH); blueToothSerial.println("pin 6 HIGH"); break;
case '4': digitalWrite(7, HIGH); blueToothSerial.println("pin 7 HIGH"); break;
case '5': digitalWrite(4, LOW); blueToothSerial.println("pin 4 LOW"); break;
case '6': digitalWrite(5, LOW); blueToothSerial.println("pin 5 LOW"); break;
case '7': digitalWrite(6, LOW); blueToothSerial.println("pin 6 LOW"); break;
case '8': digitalWrite(7, LOW); blueToothSerial.println("pin 7 LOW"); break; } delay(100); }

Before using it for the first time you will need to pair the BtB with your Android device. The PIN is set to a default of four zeros. After setting up the hardware and uploading the sketch, wait until the LEDs on the BtB blink alternately – at this point you can get a connection and start communicating. In the following video clip you can see the whole process:


Where to from here?

There are many more commands that can be set using terminal software from a PC with a Bluetooth adaptor, such as changing the PIN, device name and so on. All these are described in the BtB Wiki page along with installation instructions for various operating systems.

Once again I hope you found this article interesting and useful. The Bluetooth Bees are an inexpensive and useful method for interfacing your Arduino to other Bluetooth-compatible devices. For more information and product support, visit the Seeedstudio product pages.

Bluetooth Bees are available from Seeedstudio and their network of distributors.

Disclaimer – Bluetooth Bee 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.

By John Boxall

Arduino and FFD51 Incandescent Displays

In this article we examine another style of vintage display technology – the incandescent seven-segment digital display. We are using the FFD51 by the IEE company (data sheet.pdf) – dating back to the early 1970s. Here is a close-up of our example:

You can see the filaments for each of the segments, as well as the small coiled ‘decimal point’ filament at the top-right of the image above.  This model has pins in a typical DIP format, making use in a solderless breadboard or integration into a PCB very simple:

It operates in a similar manner to a normal light bulb – the filaments are in a vacuum, and when a current is applied the filament glows nicely. The benefit of using such as display is their brightness – they could be read in direct sunlight, as well as looking good inside.  At five volts each segment draws around 30mA. For demonstration purposes I have been running them at a lower voltage (3.5~4V), as they are old and I don’t want to accidentally burn out any of the elements. Using these with an Arduino is very easy as they segments can be driven from a 74HC595 shift register using logic from Arduino digital out pins. (If you are unfamiliar with doing so, please read chapters four and five of my tutorial series). For my first round of experimenting, a solderless breadboard was used, along with the usual Freetronics board and some shift register modules:

Although the modules are larger than a DIP 74HC595, I like to use these instead. Once you solder in the header pins they are easier to insert and remove from breadboards, have the pinouts labelled clearly, are almost impossible to physically damage, have a 100nF capacitor for smoothing and a nice blue LED indicating power is applied.

Moving forward – using four shift register modules and displays, a simple four-digit circuit can be created. Note from the datasheet that all the common pins need to be connected together to GND. Otherwise you can just connect the outputs from the shift register (Q0~Q7) directly to the display’s a~dp pins.

Question – Which company coined the term “Numitron”?

Some of you may be thinking “Oh at 30mA a pin, you’re exceeding the limits of the 74HC595!”… well yes, we are. However after several hours they still worked fine and without any heat build-up. However if you displayed all eight segments continuously there may be some issues. So take care. As mentioned earlier we ran the displays at a lower voltage (3.5~4V) and they still displayed nicely. Furthermore at the lower voltage the entire circuit including the Arduino-compatible board used less than 730mA with all segments on –  for example:

 For the non-believers, here is the circuit in action:

Here is the Arduino sketch for the demonstration above (download).

Now for the prototype of something more useful – another clock. :) Time to once again pull out my Arduino-compatible board with onboard DS1307 real-time clock. For more information on the RTC IC and getting time data with an Arduino please visit chapter twenty of my tutorials. For this example we will use the first two digits for the hours, and the last two digits for minutes. The display will then rotate to showing the numerical day and month of the year – then repeat.

Operation is simple – just get the time from the DS1307, then place the four digits in an array. The elements of the array are then sent in reverse order to the shift registers. The procedure is repeated for the date. Anyhow, here is the sketch (download). And the clock in action:

So there you have it – another older style of technology dragged into the 21st century. If you enjoyed this article you may also like to read about vintage HP LED displays. Once again, I hope you found this article of interest. Thanks to the Vintage Technology Association website for background information.

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.

By John Boxall

Tektronix CFC250 Teardown

ntroduction

Time for something different – and perhaps the start of several new articles containing teardowns. In our first instalment we examine the Tektronix CFC250 100 MHz frequency counter circa 1994: Not the most spectacular of designs, but it has worked well right until the present day. The update speed of the display wasn’t lightning fast, however for the time it would have been quite reasonable. Here is a short video I shot last year comparing it against a small frequency counter kit:

However after staring at this thing every day on my desk for a couple of years it has now become impossible to overcome the temptation to have a look inside. Therefore the reason for this article. You can click on the images to see the full-size version. So let’s go back to 1988 and check out the CFC250…

External tour

A quick look around the outside. The casing is reminiscent of the Escort brand of test equipment from the era, and (I suspect that) they OEM’d the CFC250 for Tektronix. (Interestingly enough Agilent bought the assets of Escort in 2008). Moving forward, the external images of the CFC250 starting with the front:

… and the rear. The AC transformer is tapped out to accept four different mains voltages, which you can select with the slide switches:

Opening up the unit involves removing screws from the base. The first ones were only for the feet, so they could stay put:

It was the screw on the right of the foot that was the key to entry. After removing them from each side and the other pair on the rear-bottom, the top casing pulls off easily…

Internal tour

… leaving us with the internals for all to see:

Although the LED display is a fair giveaway to the age of the CFC250,  a quick look around the PCB confirms it… and the display is ultimately controlled by an LSI Systems LS7031 “Six decade MOS up counter” (data sheet.pdf). It is matched to some DS75492N MOS-to-LED hex digit driver ICs (data sheet.pdf) and some other logic ICs. It is interesting to compare the number of parts required to drive the LEDs compared to a contemporary microcontroller and something like the TM1640 used in this module.

Now for the LED display board:

Nothing too out of the ordinary. A closer look at the rear panel shows some very neat AC mains wiring:

Now for some more close-ups. Here we can see the use of the MM5369 17-stage oscillator/divider (data sheet.pdf). I haven’t seen one of these for a while, the last time we used them was for a 60Hz timebase. However in this case it would be used to create an accurate timebase within which the CFC250 would count the number of incoming pulses:

 The removal of two more screws allows removal of the main PCB from the base of the cabinet, which reveals as such:

There is also an opaque plastic sheet cut to fit, helping insulate the PCB from the rest of the world:

Question – In which year was Tektronix founded?

 The PCB is single-sided and very easy to follow. I wonder if it was laid out by hand?

It reminds me of some old kits from the past decade.  Moving forward, there is a metal shield around the PCB area of signal input and low-pass filter:

A quick desolder of three points allows removal of the shield, and reveals the following:

At the top-left of the above image reveals a resistor in a somewhat elevated position, as shown below:

If anyone can explain this one, please leave a comment below.

 Conclusion

What impressed me the most during this teardown was the simple way in that the unit was designed – all through-hole parts, mechanical connections either soldered or nuts and bolts, and all components labelled. I can imagine that during the lifespan of the CFC250 it would have been relatively simple to repair. Such is the price of progress. And yes, it worked after putting it all back together again.

In the meanwhile, full-sized original images are available on flickr. I hope you found this article of interest. Coming soon we will have some more older-technology items to examine and some new tutorials as well.

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, 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.

By John Boxall

Arduino and TM1640 LED Display Modules

Introduction

The purpose of this article is to demonstrate the use of the second (here’s the first) interesting LED display module I discovered on the dealextreme website, for example:

As you can see the display unit holds a total of sixteen seven-segment LED digits using four modules. However thanks to the use of the TM1640 controller IC

… the entire display is controlled with only four wires – 5V, GND, data in and clock:

The board also ships with the 30cm long four-wire lead and fitted plug. Finally, there is a ‘power on’ LED on the right-hand end of the board:

Getting Started

Now to make things happen. From a hardware perspective – it couldn’t be easier. Connect the 5V and GND leads to … 5V and GND. The data and clock leads will connect to two Arduino digital pins. That’s it. The maximum current drawn by the display with all segments on is ~213mA:

So you should be able to drive this from a normal Arduino-compatible board without any hassle. Please note that the TM1640 IC does heat up somewhat, so you may want to consider some sort of heatsink if intending to max out the display in this manner.

From the software side of things you will need to download and install the TM1638 library (yes) which also handles the TM1640 chip. To simply display text from a string on the display, examine the following sketch:

#include  // yes you need both #include <TM1640.h>
// define a module on data pin 7, clock pin 8 TM1640 module(7, 8);
void setup() { // nothing to do here }
void loop() { String name = "0123456789012345"; module.setDisplayToString(name, 0b0000000000000000); delay(32766); }

Which will display:

The sixteen digit binary number in the module.setDisplayToString() line controls the decimal points – 0 for off and 1 for on. For example, changing it to

0b1010101010101010

will display:

You can also display text in a somewhat readable form – using the characters available in this list.

Displaying numbers is very easy, you can address each digit individually using:

module.setDisplayDigit(x, y, true/false);

where x is the digit, y is the position (0~15), and true/false is the decimal point. At this time you can’t just send a long integer down to the display, so you will need to either convert your numbers to a string or failing that, split it up into digits and display them one at a time.

In the following example sketch we display integers and unsigned integers by using the C command sprintf(). Note the use of %i to include an integer, and %u for unsigned integer:

#include  // required because the way arduino deals with libraries #include
// define a module on data pin 7, clock pin 8 TM1640 module(7, 8);
void setup() { // nothing to do here }
void loop() { char text[17]; int z;
for (z=0; z<5; z++) { int a=32767; sprintf(text, "INTEGER %i",a); module.setDisplayToString(text);  delay(1000); module.clearDisplay();
unsigned int ui=65535; sprintf(text, "UNSIGNED %u",ui); module.setDisplayToString(text); delay(1000); module.clearDisplay(); }  for (z=0; z<32767; z++) { sprintf(text, "COUNTING %i",z); module.setDisplayToString(text);  delay(10); } }

And the resulting output:

Now you have an idea of what is possible, a variety of display options should spring to mind. For example:

Again, this display board was a random, successful find. When ordering from dealextreme, do so knowing that your order may take several weeks to arrive as they are not the fastest of online retailers; and your order may be coming from mainland China which can slow things down somewhat. Otherwise the module worked well and considering the minimal I/O and code requirements, is a very good deal.

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.

By John Boxall

Hewlett-Packard 5082-7415 LED Display from 1976

In this article we examine a five digit, seven-segment LED display from Hewlett-Packard, the 5082-7415:

According to the data sheet (HP 5082-series.pdf) and other research this was available for a period of time around 1976 and used with other 5082-series modules in other HP products. Such as the Hewlett-Packard 3x series of calculators, for example:

<img class="aligncenter" title="(C) David J Hicks, http://www.hpmuseum.org/” src=”http://www.hpmuseum.org/31.jpg&#8221; height=”379″ alt=”” style=”display: block; margin-left: auto; margin-right: auto; border: 1px solid #333333;” width=”199″ />

Using the display is very easy – kudos to the engineers at HP for making a simple design that could be reusable in many applications. The 5082-7415 is a common-cathode unit and wiring is very simple – there are the usual eight anodes for segments a~f and the decimal point, and the five cathodes.

Question – Name three HP calculators that use LED displays

As this module isn’t too easily replaceable, I was very conservative with the power supply – feeding just under 1.6V at 10mA to each of the anode pins. A quick test proved very promising:

Excellent – it worked! But now to get it displaying some sort of interesting way. Using the following hardware…

  • Freetronics Eleven Arduino-compatible board
  • Two 74HC595 shift registers
  • Eight 560 ohm resistors
  • Five 1k ohm resistors
  • Five BC548 transistors
  • A large solderless breadboard and plenty of wires

… it was connected in the same method as a four-digit display (except for the extra digit) as described in mytutorial. Don’t forget to use the data sheet (HP 5082-series.pdf). You don’t have to use Arduino – any microcontroller with the appropriate I/O can take care of this.

Here is a simple Arduino sketch that scrolls through the digits with and then without the decimal point (download):

// Arduino sketch to demonstrate HP 5082-7415 LED Display unit // John Boxall, April 2012
int clockPin=6; int latchPin=7; int dataPin=8;
// array for cathodes - sent to second shift register byte digits[]={
B10000000, B01000000, B00100000, B00010000, B00001000, B11111000}; // use digits[6] to turn all on
// array for anodes (to display 0~0) - sent to first shift register byte numbers[]={
B11111100, B01100000, B11011010, B11110010, B01100110, B10110110, B10111110, B11100000, B11111110, B11110110};
void setup() { pinMode(clockPin, OUTPUT); pinMode(latchPin, OUTPUT); pinMode(dataPin, OUTPUT); }
void loop() { int i; for ( i=0 ; i<10; i++ ) { digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, LSBFIRST, digits[6]); shiftOut(dataPin, clockPin, LSBFIRST, numbers[i]); digitalWrite(latchPin, HIGH); delay(250); } // now repeat with decimal point for ( i=0 ; i<10; i++ ) { digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, LSBFIRST, digits[6]); shiftOut(dataPin, clockPin, LSBFIRST, numbers[i]+1); digitalWrite(latchPin, HIGH); delay(250); } }

And the results:

Now for something more useful. Here is a function that sends a single digit to a position on the display with the option of turning the decimal point on or off:

void displayDigit(int value, int posit, boolean decPoint) // displays integer value at digit position posit with decimal point on/off { digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, LSBFIRST, digits[posit]); if (decPoint==true) { shiftOut(dataPin, clockPin, LSBFIRST, numbers[value]+1);  }  else  { shiftOut(dataPin, clockPin, LSBFIRST, numbers[value]);  } digitalWrite(latchPin, HIGH); }

So if you wanted to display the number three in the fourth digit, with the decimal point – use

  displayDigit(3,3,true);

with the following result:

We make use of the displayDigit() function in our next sketch. We introduce a new function

displayInteger(number,cycles);

It accepts a long integer between zero and 99999 (number) and displays it on the module for cycles times. You can download the sketch from here.

// Arduino sketch to demonstrate HP 5082-7415 LED Display unit // Displays numbers on request // John Boxall, April 2012
int clockPin=6; int latchPin=7; int dataPin=8;
// array for cathodes - sent to second shift register byte digits[]={ B10000000, B01000000, B00100000, B00010000, B00001000, B11111000}; // use digits[6] to turn all on
// array for anodes (to display 0~0) - sent to first shift register byte numbers[]={ B11111100, B01100000, B11011010, B11110010, B01100110, B10110110, B10111110, B11100000, B11111110, B11110110};
void setup() { pinMode(clockPin, OUTPUT); pinMode(latchPin, OUTPUT); pinMode(dataPin, OUTPUT); randomSeed(analogRead(0)); }
void clearDisplay() // turns off all digits { digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, LSBFIRST, 0); shiftOut(dataPin, clockPin, LSBFIRST, 0);  digitalWrite(latchPin, HIGH); }
void displayDigit(int value, int posit, boolean decPoint) // displays integer value at digit position posit with decimal point on/off { digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, LSBFIRST, digits[posit]); if (decPoint==true) { shiftOut(dataPin, clockPin, LSBFIRST, numbers[value]+1);  }  else  { shiftOut(dataPin, clockPin, LSBFIRST, numbers[value]);  } digitalWrite(latchPin, HIGH); }
void displayInteger(long number,int cycles) // displays a number 'number' on the HP display.  { long i,j,k,l,z; float f; clearDisplay(); for (z=0; z
void loop() { long l2; l2=random(0,100001); displayInteger(l2,400); }

For demonstration purposes the sketch displays random numbers, as shown in the video below:

Finally after some more hunting around I found some four-digit knock-off versions on eBay (item #120876219746) , so have ordered them and will report back once they arrive. In the meanwhile, I hope you found this article of interest. Thanks to the Vintage Technology Association website and the Museum of HP Calculators for background information and Freetronics for the use of the Eleven.

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.

By John Boxall

April 2012 Competition

Welcome back!

Another month and time for another competition! First we’ll look at the prizes, and then examine the rules of entry.

First Prize is a new Freetronics DMD – Dot Matrix Display as reviewed recently and used in Clock One:

The DMD consists of 16 rows of 32 LEDs that can run directly from an Arduino-compatible board, or at a much higher brightness using an external power supply. It is simple to program for yet a load of fun to use. Specifications include:

  • 32 x 16 high brightness Red LEDs (512 LEDs total) on a 10mm pitch
  • 5V operation
  • Viewable over 12 metres away
  • Tough plastic frame
  • Controller ICs on board, simple clocked data interface
  • Arduino compatible library, graphics functions and example support
  • Dimensions: 320(W) x 160(H) x 14(D)mm (30mm(D) including rear connectors)

The winner can select either a red DMD as shown in the video above or a blue one as such:

Second Prize consists of one each of the eleven modules from the Freetronics Module/Sensor range, as reviewed recently:

With this range of modules you will be able to sense temperature, humidity, magnetic fields, light and sound pressure levels, sound and shock. Plus light up with the RGB LED, get more I/O with the expansion module, interface with the level shifter board, control high currents with the N-MOSFET, and power the lot with the tiny switch mode power supply. Available from Freetronics or a reseller near you.

How to enter!

There will be five questions for you to answer spread across articles published between the 1st and 30th of April.  At the end of April and once you have answers to all five questions, email the answers along with yourfull name, email address and postal address to competition at tronixstuff dot com with the subject heading April.

During the second week of May, all the correct entries will be collated and two randomly chosen. The first correct entry drawn will win first prize, and the second entry the second prize. Entries will be accepted until 02/05/2012 0005h GMT.

As with any other competition, there needs to be some rules:

  • Incomplete entries will be rejected, so follow the instructions!
  • The winners’ first name and country will be announced publicly;
  • The winners’ name and mailing address will be passed to the prize supplier only for the purpose of prize delivery and not for any form of marketing.
  • Entries that contain text not suitable for minors or insulting to the competition will be rejected (seriously – it happens);
  • Prizes will be delivered via Australia Post domestic or regular international air mail. We take absolutely no responsibility for packages that go missing or do not arrive. If you live in an area with a “less than reliable” domestic postage system, you can pay for registered mail or other delivery service at your expense.
  • Winners outside of Australia will be responsible for any taxes, fees or levies imposed by your local Governments (such as import levies, excise, VAT, etc.) upon importation of purchased goods;
  • Prizes may take up to 45 days to be received;
  • No disputes will be entered in to;
  • Prizes carry no warranty nor guarantee – and are to be used or abused at entirely your own risk;
  • Entries will be accepted until 02/05/2012 0005h GMT.

Thanks to Freetronics for the prizes!

 In the meanwhile, have fun and keep an eye out for the four competition questions spread through the February posts… In the meanwhile, 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.

 

By John Boxall

Project: Clock Three – A pillow clock

Introduction

Time for another instalment in my irregular series of irregular clock projects. In contrast with the minimalism of Clock Two, in this article we describe how to build a different type of clock – using the “lilypad” style of Arduino-compatible board and components designed for use in e-textiles and wearable electronics. As the LilyPad system is new territory for us, the results have been somewhat agricultural. But first we will examine how LilyPad can be implemented, and then move on to the clock itself.

The LilyPad system

By now you should have a grasp of what the whole Arduino system is all about. If not, don’t panic – see my series of tutorials available here. The LilyPad Arduino boards are small versions that are designed to be used with sewable electronics – in order to add circuitry to clothing, haberdashery items, plush toys, backpacks, etc. There are a few versions out there but for the purpose of our exercise we use the Protosnap Lilypad parts which come in one PCB unit for practice, and then can be ‘snapped out’ for individual use. Here is an example in the following video:

The main circular board in the Arduino-type board which contains an ATmega328 microcontroller, some I/O pins, a header for an FTDI-USB converter and a Li-Ion battery charger/connector. As an aside, this package is  good start – as well as the main board you receive the FTDI USB converter, five white LEDs, a buzzer, vibration module, RGB LED, a switch, temperature sensor and light sensor. If you don’t want to invest fully in the LilyPad system until you are confident, there is a smaller E-Sewing kit available with some LEDs, a battery, switch, needle and thread to get started with.

Moving forward – how will the parts be connected? Using thread – conductive thread. For example:

This looks and feels like normal thread, and is used as such. However it is conductive – so it doubles as wire. However the main caveat is the resistance – conductive thread has a much higher resistance than normal hook-up wire. For example, measuring a length of around eleven centimetres has a resistance of around 11Ω:

So don’t go too long with your wire runs otherwise Ohm’s Law will come into play and reduce the available voltage. It is wise to try and minimise the distance between parts otherwise the voltage potential drop may be too much or your digital signals may have issues. Before moving on to the main project it doesn’t hurt to practice sewing a few items together to get the hang of things. For example, run a single LED from a digital output – here I was testing an LED by holding it under the threads:

Be careful with loose live threads – it’s easy to short out a circuit when they unexpectedly touch. Finally for more information about sewing LilyPad circuits, you can watch some talent from Sparkfun in this short lesson video:

And now to the Clock!

It will be assumed that the reader has a working knowledge of Arduino programming and using the DS1307 real-time clock IC. The Arduino sketches used in this article are written for v23 and not v1.0. The clock will display the time using four LEDs – one for each digit of the time. Each LED will blink out a value which would normally be represented by the digit of a digital clock (similar to blinky the clock). For example, to display 1456h the following will happen:

  • LED 1 blinks once
  • LED 2 blinks four times
  • LED 3 blinks five times
  • LED 4 blinks six times

If a value of zero is required (for example midnight, or 1000h) the relevant LED will be solidly on for a short duration. The time will be set when uploading the sketch to the LilyPad, as having two or more buttons adds complexity and increases the margin for error. The only other hardware required will be the DS1307 real-time clock IC. Thankfully there is a handy little breakout board available which works nicely. Due to the sensitivity of the I2C bus, the lines from SDA and SCL to the LilyPad will be soldered. Finally for power, we’re using a lithium-ion battery that plugs into the LilyPad. You could also use a separate 3~3.3V DC power supply and feed this into the power pins of the FTDI header on the LilyPad.

Now to start the hardware assembly. First – the RTC board to the LilyPad. The wiring is as follows:

  • LilyPad + to RTC 5V
  • LilyPad – to RTC GND
  • LilyPad A4 to RTC SDA
  • LilyPad A5 to RTC SCL
Here is an our example with the RTC board soldered in:

At this stage it is a good idea to test the real-time clock. Using this sketch, you can display the time data on the serial monitor as such:

Sewing it together…

Once you have the RTC running the next step is to do some actual sewing. Real men know how to sew, so if you don’t – now is the time to learn. For our example I bought a small cushion cover from Ikea. It is quite dark and strong – which reduces the contrast between the conductive thread and the material, for example:

However some people like to see the wires – so the choice of slip is up to you. Next, plan where you want to place the components. The following will be my rough layout, however the LilyPad and the battery will be sewn inside the cover:

The LilyPad LEDs have the current-limiting resistor on the board, so you can connect them directly to digital outputs. And the anode side is noted by the ‘+’:

For our example we connect one LED each to digital pins six, nine, ten and eleven. These are also PWM pins so a variety of lighting effects are available. The cathode/negative side of the LED modules are connected together and then return to the ‘-’ pad on the LilyPad. The actual process of sewing can be quite fiddly – so take your time and check your work. Always make note to not allow wires (threads) to touch unless necessary. It can help to hold the LilyPad up and let the cloth fall around it to determine the location of the LilyPad on the other side, for example:

As this was a first attempt – a few different methods of sewing the parts to the cloth were demonstrated. This becomes evident when looking on the inside of the slip:

… however the end product looked fair enough:

After sewing in each LED, you could always upload the ‘blink’ sketch and adapt it to the LEDs – a simple way to test your sewing/wiring before moving forward.

The sketch…

As usual with my clock projects the sketch is based around the boilerplate “get time from DS1307″ functions. There is also the function blinkLEDwhich is used to control the LEDs, and the time-to-blinking conversion is done in the function displayTime. For those interested, download and examine the sketch.

The results!

Finally in the video clip below our pillow clock is telling the time – currently 1144h:

So there you have it, the third of many clocks we plan to describe in the future. Once again, this project is just a demonstration – so feel free to modify the sketch or come up with your own ideas. Thanks to Little Bird Electronics for the LilyPad items.

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.

By John Boxall

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:

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 CC1101low-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:

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 (click to enlarge):

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:

// RFbee demonstration sketch
int ledPin = 13; byte incoming=0;
void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); }
void blinkLED(int i) { for (int a=0; a
void loop() { if (Serial.available() > 0) { incoming = Serial.read(); switch(incoming) { case 'A': blinkLED(1); break; case 'B': blinkLED(2); break; case 'C': blinkLED(3); break; default: blinkLED(5); } Serial.println("Blinking completed!"); delay(2000); Serial.flush(); } }

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):

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 candownload 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

transmitData(*byte data, byte length, byte sourceAddress, byte destinationAddress)

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:

byte testData[4] = {'A','B','C','D'};
void sendTestData() { // send the four bytes of data in the byte testData[] from address 1 to address 2 transmitData(testData,4,1,2); delay(1000); }

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:

result=receiveData(rxData, &len, &sourceAddress, &destinationAddress, (byte *)&rssi , &lqi);

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.

By John Boxall