Sunday, August 30, 2009

This is the second post related to the testing of Wiseduino. The first one talked about RTC and it started by showing how to correctly plug in the FTDI cable or the FTDI breakout.

Now lets move on, to the external EEPROM, a 24LC256 memory chip, with a capacity of 32KB. It is connected on I2C (analog 4 and 5) and uses the Wire library to talk with the microcontroller.

We will test the EEPROM by loading some text from a file. This is how this works: a program on the PC reads the text file and sends the characters to Wiseduino, which, in turn, is running a sketch that reads the incoming characters and saves them to EEPROM.

Some VBscript code is included at the bottom of the pde file. Cut and paste that VBscript code into its own file, and name it writeFileToCom.vbs, for example (the extension vbs is mandatory). (This is tested and working on Windows. On Linux or Mac OSX, this script needs to be re-written.)

With the eeprom_quotes.pde sketch uploaded, Wiseduino waits for characters to be received from the PC. Now execute the writeFileToCom.vbs VBscript by double clicking on the file (Windows associates the file with its script engine, wscript.exe).
The VBscript opens the file C:\docs\quotes.txt, reads 10 characters at a time, then sends them over the serial port, until the end of file is reached.
Two things are required in preparation for the text transfer:

in the VBscript, change the COM port number from COM7 to the one you are using;

The process of transferring the content of the file takes about 10 minutes for a 32KB of text at a baud rate of 9600.

We check that the text was saved correctly in the EEPROM by reading its content. We will use the same eeprom_quotes.pde to read data from EEPROM. To do this, open the serial monitor, then type "\l" (backslash, lower l) in its input box and hit "Send" button. The bottom window should start displaying the lines of text stored in the EEPROM.

Updated Oct 4, 2010The most recent version of Wiseduino has pin 4 of the FTDI connector wired to Vcc (5V). Therefore, when the FTDI connector is plugged in, the board is powered.

With the Wiseduino board assembled, we can start testing it by uploading some sketches.

To upload the sketches, you would need the FTDI cable or the FTDI breakout.
Make sure that the FTDI cable or the FTDI breakout are plugged in correctly, as shown in the photos below.

Also, make sure the board is connected to power (preferably 4 AA rechargeables) and the power switch is in the upper position, as in the above photos. This is because pin 4 of the FTDI header, with 5V coming from FTDI, is not connected to the board. There were two reasons behind this decision: 1) a switch between the external power and FTDI should have been used, and 2) FTDI cables and breakouts come in 2 flavours, 5V and 3V3.

Never power Wiseduino with more than 5V.Do not connect the supplied battery snap to a 9V battery because it will damage your Wiseduino. The snap is for battery holders, normally holding 4 AA rechargeables (as in the above photo).

After launching the Arduino IDE, make sure the right board and serial port are selected, as shown in the images below.

Lets start by testing the RTC. First, download this sketch and install it (unzip it) in the arduino/hardware/libraries folder. A new folder, named rtc, will be created, and it will contain the RTC class (courtesy of Arduino playgroung) and the rtc.pde sketch in the examples subfolder.

Load the sketch into Arduino IDE (13 or later). Change the time in setup() function, then compile it and upload it to the board.

After uploading the above sketch once, the RTC has the current time and it will keep the time even when the Wiseduino board is not powered (due to the onboard backup battery). Now, modify the rtc.pde sketch by commenting out all lines in setup(), except Serial.begin. This will ensure that the microcontroller does not set the RTC every time the board is reset or powered.

Friday, August 28, 2009

This is the documentation with instructions for assembling the Wiseduino board.

Basically, this is a list of the steps for preparing, placing and soldering the components.

I assume that Wiseduino is not the first board you solder and you have more than basic soldering skills.

I have to be honest and acknowledge that, trying to follow the high standards set by ladyada in her tutorials, I failed. Now I appreciate those tutorials even more. (I suspect that a second person took photos of her soldering; otherwise, using the timer is a gamble.)

If you have the SMD version of the EEPROM (24LC256) or RTC (DS1307), solder those first. To make it easier, flux the pad(s) with the flux pen. If not soldered first, it will be harder to access the SMD pads later. Pay attention to the orientation of the chip. Pin 1 is marked with a dot, on both the chip and PCB.

Next, solder the sockets for the microcontroller, EEPROM and RTC (if you have the through hole chips). The notches on the sockets should match those in the silkscreen.

Solder the battery holder. Make sure it is inserted all the way.

Next, solder the power connector, then the 6-pin FTDI header.

Place the micro switch on the pads and solder the middle terminal so that the switch's lever is just 1 mm out of the board's edge. After the micro switch is positioned correctly, solder the other 2 terminals.

Next step is soldering the resistors. All 4 of them need to be inserted and soldered vertically. For this, one of their terminals needs to be bent 180 degrees.

Insert and solder the 4 capacitors.

Next, solder the 16MHz resonator.

Before soldering the crystal for RTC (32,768 Hz), bend its terminals, with pliers, to 90 degrees, about 2 mm from their base. This allows the crystal to stay parallel and close to the board.

Break the 40-pin female header into 4 pieces: two 8-pin headers and two 6-pin headers. This is done by removing one pin, then cutting with a wire-cutter along the empty place.

Position the headers in their locations, then turn over the board and let it stand on the headers, making sure that they are perpendicular to the board. Now solder all four headers.

Solder the transistor, placing it to match its shape in silkscreen.

Optionally (if you want to use the XBee adapter), insert the 10-pin female header on the other side (not the parts side) of the PCB and solder its pins on the parts side.

Insert the chips (ATmega328, 24LC256, DS1307) into their respective sockets, paying attention to their orientation, by matching the notches on the chip with the notches in the socket(s).

Carefully insert the cell battery into its holder. Place the cell under the two plastic stoppers, then gently push the cell down against the lateral contact (it helps if that contact is lifted up a tad, from the hook, with a small screwdriver).

The assembled board should look similar to the one below.

A few clarifications and explanations about the Wiseduino board:

the FTDI header does not have the 5V power pin connected; therefore 5V needs to be supplied from the 2-pin power connector, usually 4 AA rechargeable batteries;

the power slide switch turns the power on when its position is up (towards the top of the board);

the board does not have standoff mounts because of the XBee adapter that can be placed on the back; in Wise Clock, the board is standing on its edge, with the LED matrix shield plugged in; should the board need to be mounted (without the Xbee, obviously) to a case or some other surface, I recommend using velcro (with sticky tape on one side);

the row of headers parallel to D0-D13 headers is designed to be used with .1" prototype board, similar to Seeeduino (Arduino clone from seeedstudio);

Friday, August 7, 2009

Last night I was able to finish the prototype of Wise4Sure. The board has ATmega644 as its core, as well as an SD card socket plus the additional circuitry (voltage divider resistors, 3V3 regulator), an RTC with DS1307 and backup battery, and a connector for the 16x32 LED display from Sure Electronics (hence its name).

Amazingly, after the few modifications, required by ATmega644, of the SDuFAT and Wire libraries, it worked from the first try.

Following are photos of the assembled and partially encased Wise4Sure project. It contains the LED display attached to the plexiglass panel, and the Wise4Sure board plugged in the back of the display. Power is provided through either FTDI or USB connector.

The 4KB RAM of ATmega644 should allow for more complex applications, including IR control, wireless (XBee) communication, networking (Ethernet), X10, wave playing etc. Really looking forward to the expanded capabilities. (With ATmega328, I was barely able to combine reading from the SD card with outputting on the LED display.)