Monday, August 30, 2010

Programming DWex

All DWex boards are shipped with the latest software (available here) loaded and tested. The on-board ATmega328 controller has the bootloader already burned in.

I don't expect users ("experimenters" in the case of DWex :) not to modify and improve the code. In fact, I have a long list of TODOs myself. To help speed up the process, here are some tips and heads-up.

1. To upload the sketches, use the 3V3 FTDI breakout board or the 3V3 FTDI cable (remember that the board is designed to work at 3V; it is 5V tolerant though).

2. Use a 6-pin male header between the FTDI cable/breakout and the DWex board, inserted as shown below.

3. Make sure that the "green" wire of the FTDI cable (also marked on the FTDI breakout) goes to the pin marked "Green" on the DWex board.

4. The CR2032 battery must be inserted in the holder when uploading the sketch. The DWex board is not powered from the FTDI cable/breakout (pin 4 of the FTDI header is not connected).

5. In Arduino IDE, select the board as "Lilypad with ATmega328", as shown in the screenshot below.

6. The available pins (not taken by LED matrix and button) are:
  • D11, D12, D13 (MOSI, MISO, SCK respectively) accessible through the ICSP connector;
  • D0, D1 (Rx, Tx respectively) accessible through the FTDI connector;
  • D2, accessible and marked on the board as JP2;
  • D10, not connected to any pad.

7. The second (un-soldered) holder would connect another CR2032 in parallel. Although at the beginning it seemed to boost the power supply, I realized after some research that it may not be a good idea after all. I am still debating on this and I am open to suggestions.

8. With the current code, to set the time, hold the button pressed for 3-4 seconds, until the LEDs light up in circle, one after the other. When the correct time is reached, release the button. The time will then be saved in the RTC. Obviously, this method does not confer the highest accuracy.

9. The state diagram for the current implementation is shown below.

Related posts: