Fixing corroded battery contacts on the Wii Fit Balance Board

I inadvertently left some Duracell alkaline batteries in the Balance Board. Sure enough, they were already starting to leak – damaging the battery contacts in the Balance Board.

It turns out there is a relatively easy way to remove the gunk from the leaky Duracells: they are alkaline batteries, so a mild acid (household vinegar) should do the trick. After disassembling the Balance Board, carefully remove the corroded metal contacts from the battery holder and drop them in a small jar with household vinegar:

Dip battery contacts in small glass jar with vinegarIMG_5323

Watch the corrosion dissolve; if needed, use a toothbrush or Q-tip to brush the last bits of gunk from the contacts. Rinse with water, and allow the contacts to properly dry before re-assembly.

P.S. It seems that Duracell batteries are quite prone to leaking – quality sure went downhill over the years. I’m replacing all of them to prevent further damage.

Getting started with the Raspberry Pi

From their FAQ: “The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard”. The RasPi is an ultra-cheap, energy-efficient Linux computer.

Preparing the SD card on Mac OS X

  • Get a supported SD card for the OS installation (I’m using a Kingston 8GB class 4 SD card)
  • Download the Raspbian ZIP-file from http://www.raspberrypi.org/downloads (I use the most recent Raspbian “wheezy”, 2012-12-16), unzip to get at the .IMG file
  • Open Terminal on OS X
    • Insert the empty SD card and determine it’s disk name (my card was mounted at /dev/disk4s1; use “df” before and after inserting to determine the name)
    • Run “sudo diskutil unmount /dev/disk4s1” to unmount any partitions on the SD card
      (verify that disk name!)
    • Run “sudo dd if=2012-12-16-wheezy-raspbian.img of=/dev/rdisk4 bs=1m” to write the image to the raw disk device
      (again, verify that disk name!)
    • Run “sudo diskutil eject /dev/rdisk4” after the image is written to SD card.
  • Remove the SD card from your Mac – done!

The Raspberry Pi lives!

Insert the SD card into your Raspberry Pi. Connect a monitor (I use an HDMI-to-DVI cable), USB mouse and keyboard. Optionally, connect it to the network. Once you power on the Raspberry Pi, you should be greeted with a familiar Linux boot sequence. After answering a couple of questions you should see a graphical desktop environment. It has a web browser, terminal etc. just like any other Linux computer.

Since I’ll be using the Raspberry Pi mostly as a small headless server, I’ve used “raspi-config” to disable the desktop and enable SSH.

Software updates and additional packages

To install any available software updates, run “sudo aptitude update; sudo aptitude upgrade”.

If you want to use the I/O pins (for your electronics projects), you will want the WiringPi and WiringPi-Python libraries installed.

sudo apt-get install git-core
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
sudo apt-get install python-setuptools
git clone https://github.com/WiringPi/WiringPi-Python.git
cd WiringPi-Python
git submodule update --init
sudo python setup.py install

You can now access the GPIO pins using Python, or using the ‘gpio’ commandline tool.

 

Assembling the JeeLabs OOK433 Plug, part 1

JeeLabs OOK433 PlugI got some KAKU (Klik Aan Klik Uit) switches to control lighting etc. These can be remote controlled using a JeeNode with the OOK433 Plug.

This plug contains a separate receiver and transmitter board. After consulting the schematic, it appears that the receiver is hooked up to the AIO pin, while the transmitter is connected to the DIO pin. This information is needed when reconfiguring the software for the actual Port socket you plugged the OOK433 into.

There are two solder jumpers that need to be made (marked in the picture on the right):

  • The upper one selects supply voltage. According to current documentation, the rightmost two pads need to be bridged, selecting +3V.
  • The lower solder jumper should always be bridged (except if a resistor R1 is to be installed)

Note that the Receiver and Transmitter modules have “+5V’ and “+12V” markings on them – apparently, they also work at this much lower voltage.

JeeLabs OOK433 Plug with HeaderAfter making these two solder jumpers, continue assembly. I soldered a 6-pin header (not included with the kit)  to the Port connector so I can plug it straight into a JeeNode.

The trick here is to apply some solder to one pad and one pin first. Then, hold the header in place while re-heating the solder on that pad. The remaining pads can now be soldered properly. The picture shows the solder jumpers I made, as well as the preparations for soldering the 6-pin header in place.

Make sure you get shiny solder joints that are properly heated (lead-free solder tends to shine a bit less than the 60/40 I use).

Next up: the transmitter module. Note that when soldering, you usually work from “lowest” to “highest” component. This makes life easier. Simply insert the transmitter module into the 3 holes and solder it. Note that the module has an antenna connector (marked “ANT”) for adding a straight-wire antenna, approx. 17cm in length. This corresponds to 1/4 wavelength at 433MHz.

OOK433 Plug with Transmitter moduleFinally, the receiver module. Insert it into the 4 holes and solder it. This module also has an antenna connector, you may want to add a 17cm straight-wire antenna here as well.

The end result is in the picture below. Now for the moment of truth: trying to make it work with a JeeNode and a software sketch.

This is where my trouble began. I used various sketches with my new KAKU remote, to no avail:

I searched the blog and forums using Google (“site:jeelabs.net OOK433”) and found several people struggling to make the OOK433 Plug work. Several issues appear to be at play here:

  1. Confusion regarding the correct supply voltage; it seems that +3V is not enough.
    This means that you would need to bridge the leftmost two pads on the upper solder jumper, instead of the rightmost two pads.
  2. Confusion regarding port numbers / Arduino pin numbers.
    The KlikAanKlikUit_A_type sketch is the only one that seems to clearly document where the Plug is expected to be for the sketch to work.
  3. Confusion regarding the antennas being “optional” or not.
    I have no antennas connected at the moment, but I’m using the remote at close range so it should not be a problem.
  4. Confusion regarding the different KAKU protocols out there.
    I think I have the most recent protocol, with house code (A-D on my remote). The old protocol apparently does not have that.

All in all, quite a few variables ;-)

I decided to go ahead with the ookScope2.ino sketch – that appears to be a fairly recent sketch; hopefully that code works as expected. First hurdle: determining which port to plug the OOK433 Plug into…

The code contains this line:

#define OOK_PIN   2   // this is the input pin with the signal to be analyzed

This might refer to AVR pin PD2, Arduino pin “Digital 2” but that would mean it’s connected to the RFM12B INT line! Not very likely… I tried the code, and apart from the [ookScope] identifier, nothing happened. So, where does that OOK433 Plug need to go for the sketch to work?

OK, back to the schematic I talked about at the start of this post. The OOK433 receiver module appears to be connected to the AIO pin. If I want to use the plug in Port 3, I need to find the proper value for AIO3. That would be Analog 2 / Digital 16 (hey, ‘2’ looks familiar but it didn’t work).

I then tried seting OOK_PIN to 16 (Digital 16), plugged the OOK433 into Port 3 and behold! The sketch starts, and emits binary garbage on the serial output! This is promising!

Next up: install the JeeRev / JeeMon software on my Mac according to instructions. Unfortunately, that didn’t result in a nice bar graph display – the bars remain at zero, even though I pressed the remote buttons. Perhaps the ookScope2.ino sketch doesn’t work with this version of the JeeMon software? What’s next? Debugging the JeeMon installation? Nah…

Anyway, my head hurts after reading through the various forum and blog posts – once I get this working I’ll post “part 2” of this adventure ;-)

JeeLabs OOK433 Plug, completely assembled

P.S.: I think we as a community should work on improving the “Out of Box Experience” for the JeeLabs hardware. Detailed assembly instructions, a simple test sketch with clear instructions on setting up the test bed – life would be so much easier ;-) If possible, add a low-level hardware diagnostics mode in that test sketch to help isolate the cause of any hardware-related problems. For example, try communicating over the SPI / I2C bus. If that doesn’t work, you might have to inspect your soldering. And most importantly: find a way to reduce @JCW’s workload – it would not be realistic to expect him to do all the work on documentation / test sketches etc.

Still massively enjoying the JeeLabs learning experience, one (steep) step at a time ;-)

Onwards!

Assembling the JeeLabs LCD Plug

Assembled the JeeLabs LCD PlugToday I received my new items from JeeLabs – an LCD Plug and a set of stacking headers.

After soldering the control board to the LCD display,I tried compiling the lcd_demo.ino demo sketch. No luck – it seems that the code no longer compiled with Arduino 1.0.

I added the include-file that was missing:

#include <PortsLCD.h>

and suddenly… nothing happened.

JeeLabs LCD Plug 2 annotatedI verified the connections – everything looked good. Oh well – “if all else fails, read the manual”. There were no detailed assembly instructions for this kit, so I had to search through various posts to help debug the issue.

Turns out that you have to set two solder jumpers (Logic to 3v3, Backlight to 3v3) as well as short out a current limiting resistor (which is not actually present on the board). Click the annotated image on the left for a (blurry) close-up.

This still did not seem to solve the problem – the backlight worked, but still no text on the display. After adjusting the contrast level with the trimpot (near the read arrow in the image), the display finally sprang to life. I had to rotate it completely counter-clockwise.

The test assembly looks like this – battery holder on top, JeeNode in the middle, LCD Plug at the bottom of the image. The LCD Plug is connected to Port 1 on the JeeNode.

LCD Plug test assembly, running off a battery

Experimenting with the JeeLabs Room Node

JeeNode with Room Node attachedAfter many years I’ve re-discovered electronics as a hobby, thanks to the JeeLabs and Arduino communities.

I’m setting up a small electronics lab with some basic equipment like the Rigol DS1052E oscilloscope (approx. 300 Euros; I “upgraded” mine to the DS1102E firmware to increase the scope’s bandwidth to 100MHz).

One of my first projects is building a Wireless Sensor Network (WSN) to measure humidity, temperature, brightness and motion in several locations at home. The necessary hardware is depicted on the right.

I’ve added a simple resistor ladder network to one of the analog inputs, allowing me to measure battery voltage; these units are supposed to be powered from rechargable batteries for at least a year. Standby power consumption of these devices is in the micro-Amp range; much better than a standard Arduino. The JeeNode comes with an onboard RF12B wireless module (not visible in the picture; it’s below the PIR board) for communications.

While experimenting with the software, I wanted to take a closer look at the actual PIR sensor output signal. The Rigol oscilloscope has all kinds of handy features that assist in analysing and measuring these signals. It can store screenshots on a USB stick, or be remote controlled from a PC – excellent value for money!

Rigol DS1052E Screenshot of PIR sensor output, 570ms pulse widthRigol DS1052E Screenshot of PIR sensor output, with additional information
As you can see, the display is only 320 pixels wide (QVGA) but that is enough for my modest needs ;-)

I tried triggering the PIR as short as possible. The PIR open collector output is pulled low (negative edge) if motion is detected. The minimum output pulse width was approx. 570 milliseconds wide. If the sensor sees continuing motion, the output will remain low for that period (at least, in Continuous trigger mode).

The accompanying “sketch” (Arduino-talk for a program that you write) sends out packets at regular intervals (once per minute, or less), containing all the telemetry info. If motion is detected, an interrupt is generated that causes a packet to be sent out immediately.

I modified a receiver “sketch” to decode the telemetry info and generate a human-readable report:

ROOM-18 1695b 221* 1 38% 22.6C 4.638V 0
 -> ack-18
ROOM-25 1695b 21* 0 46% 19.6C 5.180V 0
ROOM-18 1695b 221* 1 38% 22.7C 4.638V 0
 -> ack-18
 ? 17 166 224 91 134 200 17 70 143 23 173 91 150 205 3 49 236 76 147 243 149
 ? 45 230 233 2 36 124 197 34 202 40 8 137 155 8 37 81 182 185 91 22 183
ROOM-18 1695b 221* 0 38% 22.7C 4.638V 0

Here, I have two JeeNodes (ID 18 and 25), each outfitted with a Room Board. The 433MHz band is crowded, so you’ll see spurious traffic (indicated by ‘?’). If a proper Room Node packet is recognized, it is decoded and displayed.

The report indicates the source of the transmission (ROOM-18 or ROOM-25); free RAM (1695 bytes); brightness (0-255); motion (0-1); humidity; temperature and battery voltage. The last “0” is the Low Battery indicator.

Regular transmissions are not acknowledged; it’s no problem if you lose a couple of data points. If the PIR is triggered however, acknowledgements are requested to ensure that the central node registers this event.

I’m still working on the central node software; I’ll probably just parse the data and stick it in a RRD file or database…

Electronics + Software = hours of fun! ;-)