My adventures with a Raspberry Pi and Arduino programming

Archive for the ‘Development’ Category

LCD display working finally

Finally got around to getting my display working. I had thought I had a broken display but turns out that although Arduino analog pins can be configured to be digital pins, that won’t work with standard parallel mode LCD displays. Plugging all 6 pins to digital works fine.

Power usage stats (LCD + Arduino pro mini 3.3V):-

  • LCD backlight, no text – 3.69 mA
  • LCD backlight, 16×2 text – 3.70 mA
  • No LCD backlight, 16×2 text – 0.71 mA

So no prizes for guessing what mode I’ll have it in most of the time! I’ll have it off (no displayed text, no backlight)

Hobbytronics ArduLogger V3 and Arduino pro mini circuit…

I’ve got a nice simple working circuit for my ArduLogger V3 board. Re-jigged it just now to minimise the number of wires. Image below for your edification:-

Ardu Logger V3 and Arduino Pro Mini

Ardu Logger V3 and Arduino Pro Mini

Remember too, when using a solderable breadboard (from SparkFun) of the same size, the logging sd card board will rotate 180 degrees, and sit below the breadboard rather than sticking out. A nice compact logging circuit.

I’ve got some test software that simulates logging GPX (XML) format GPS based track information to the SD card every couple of seconds. Sample SD card append code is available on my GitHub page.

Connect the FTDI to the pins (on the right of the breadboard, above) to your computer, and you’re away!

BE AWARE: When programming the board, remove the ArduLogger breakout from the circuit, else it interferes with serial communication to the Arduino pro mini. Once reprogrammed, disconnect the FTDI cable, add the ArduLogger back in, then reconnect the FTDI (to power the circuit). Alternatively power the breadboard directly.

Note on wires above:-

  • Blue wire links ground on the logger to the Arduino
  • yellow, orange, and grey wires take a circuitous route to link 5V with VCC on the Arduino
  • The position of the logger board next to the Arduino automatically lines up and connects TX and RX pins (and RST)

The sharp eyed among you may have noticed the Arduini is a 3.3V 8MHz variant, whereas the power pin on the logger says 5V. You can run 3.3V through here quite happily.

Note that as previously mentioned, the ArduLogger board and the open logger software only works with Hardware Serial – software serial WILL NOT work. You have been warned.

ArduLog OpenLog and Software Serial…

I’ve been playing around with a great SD card logging unit from Hobby Tronics. This is a slightly improved version (and cheaper!) of the SparkFun OpenLog unit.

Software Serial has failed me on this piece though. You absolutely must use the standard hardware serial (Serial.println() ) functions in order to not lose data. Even with large multi-second delays and very little information being transferred, the Arduino Software Serial library failed to keep up.

This is unusual, as I’ve found the Software Serial library very reliable for use with GPS and 3DR radios’ serial interfaces.

I’ve successfully used the setup() routine to specify the file I want to save to. This required a bit of hackery. To send a Ctrl+Z character in Arduino (required for setting up the open log in command mode) you need to do the following in code:-

 Serial.print((char)0x1A); // Ctrl + z
 Serial.println("append " + file); // tell open log to append to a named file (file created if it doesn't exist)
 logGpx(file,team,now); // my customised logging setup function

Those delay() calls probably aren’t strictly required, but they don’t slow down my app either.

Note that char 0x1A is a hexadecimal number for ASCII character 26 (the A is the 10th character in a sequence, the 1 in the second column means 1×16 (base 16), thus 10 + 16, which is character code 26. ASCII character 26 is the same as Ctrl+Z in a terminal in Windows CoolTerm, which is the required character for entering and leaving command mode in OpenLog.

I’m using the XML based GPX format to write updates. In future I’m going to hook this up to a GPS, so it makes sense to use this format rather than NMEA as it can easily be read by online and desktop tools. You could use KML instead (Google Earth format).

I wonder how much current this little device draws?…

Power usage of just the memory card (doesn’t include the Arduino itself):-

  • During command mode, up to 12mA
  • During normal standby operation, 1.57 mA
  • During writing data, anywhere from 6.5 to 11.5 mA, averaging approx 7.8mA

Tracker project todos…

Just a quick list for my own needs…

Things already done:-

  • Proven transmitter sends valid GPS tracking data to receiver on computer
  • Built prototype transmitter and tested in the field
  • Integrated GPS, 3DR radio, Li-po charger, Li-po battery, Arduino solderable breadboard in to an enclosure
  • Tested power saving mode (7 – 15 days charge possible!)
  • Created very basic symmetric cryptography routines

Things to do next:-

  • Get route logging software working, preferably with GPX file output (OpenLogger on HobbyTronics ArduLogger platform with micro SD card)
  • Range test air to ground module outside on maximum power settings, continuous transmit
  • Investigate 3DR circuit to see if its possible to make own PCB cheaper (and integrate whole device in one half eurocard PCB)
  • Get LCD display working on protoboard
  • Get Joystick working for basic menu items on same protoboard
  • Test multiple transmitters with one receiver (including testing using ‘air’ unit for receiver, and receiving multiple signals on same receiver)
    • If can’t use air module, use usb to serial circuit for ground module (might be fun to try anyway…)
  • Test 3DR radio LBT (Listen Before Transmit) mode
  • Test encrypted messaging
  • Develop own binary format for messaging (C language struct?)

More tracker power saving tricks…

I’ve now employed a bunch of tricks to reduce power consumption. Here’s what I’d done…


I2C and software serial and hardware serial working fine!

I’ve now got all communication channels working on the Arduino Pro Mini just as I had on the Raspberry Pi (aka Ralph) and the Gertboard…


Battery pack working…

Managed to get the battery pack working with my Pro Mini and UBlox GPS…