Remote Accelerometer

ADXL335 + ATmega328 + RFM12B

What is a remote accelerometer? It’s a tiny device that has a three axis accelerometer and transmit the acceleration values to a remote host. And what is it good for? There are various uses for it. One is you attach the sensor to someone and let him jump around. On your remote machine you can use the data to produce sound or modify music. Think of it as a simplified Wiimote.

Last year Jan of came to me with the idea to make the jumping of people on a trampoline audible. We thought about it and it seemed to be easy. I tinkered with some XBees and ADXL acceleration sensors. They worked quite ok, but we had some trouble with the transmission, which sometimes just stopped for a couple of seconds. Maybe some kind of resetting, I really don’t know. Here is a video of the installation.

After that I thought, nice, but can’t we get it smaller and cheaper? So I sat down and designed a tiny custom PCB.


ADXL335 + ATmega328 + RFM12B (Schematic)

I had already two JeeNodes laying around. These boards are using a RFM12B transceiver board to communicate with each other. So I decided to use the RFM12B as XBee replacement. They are really cheap, around 3 to 4 Euros.
The device should be Arduino compatible. Mostly because of the ease of development and available libraries.

  • ATmega328P, Arduino compatible microcontroller, running at 8 MHz
  • ADXL335, 3 axis accelerometer, +/- 3g
  • RFM12B radio transceiver, 868 MHz, range of up to 100 meters
  • MCP1702 linear, low-drop voltage regulator for 3.3 V, 250 mA
  • powered by a 3.7 V lipo cell, 100-300 mA
  • 6 pin ISP header for programming the bootloader
  • 6 pin serial header to attach an FTDI-cable
  • voltage sensor to tell when the battery goes low


ADXL335 + ATmega328 + RFM12B

This is my second try on SMD. Resistors and capacitors are sized 0805. The controller is TQFP and the ADXL335 is LFCSP. LFCSP has not even pins you can hand solder. A very tiny package. As I had no stencil to place the solder paste (because I still have no laser cutter) I had to place the paste by hand. Pressing hard on the syringe and trying to work precisely at the same time is not that easy. After placing a tiny bubble of paste on every pad and gently placing all components, I heated up my hot-air rework station. Soldering with the hot-air station was easy. Not all components are well aligned, maybe because I used not enough solder paste. Often mis-aligned parts slide into place as soon as the paste gets liquid.
Next were the headers, battery connector and the RFM12B module. These were soldered traditionally with an iron.

Here is a picture of the back with the RFM12B module. The red wire is the antenna.

ADXL335 + ATmega328 + RFM12B (backside)


After having the thing assembled it’s time to test it out. First is to program the Arduino bootloader. For that you need an ISP programmer. I used the USBtinyISP from adafruit. Simply select the target (Arduino Pro Mini @ 8 MHz w/ ATmega328), programmer and the port in the Arduino IDE and select “burn bootloader”. Worked on the first try.
Next is a blink sketch to check if the serial connection and the LED works. It turns out that I used too little solder paste on the controller. After resoldering that pin the LED worked.
Next sketch was to check if the ADXL works correctly, which it did. All three axis seem to work great.
After that I had to get the transceiver working. I took the RFM12 lib from Jee Labs. You have to download the Ports lib as well to get it running. First I uploaded the RF12demo sketch, which allows to setup the RFM12 module and store the configuration in EEPROM. The module was recognized and configured with no problem at all.

Time to develop the actual firmware. Here is the sketch for the sensor.

// RF12B ADXL sensor
// config D i4 g212 @ 868 MHz

#include "Ports.h"
#include "RF12.h"

int xPin = 0;
int yPin = 1;
int zPin = 2;
int ledPin = 5;
byte buf[6];

void setup() {
  pinMode(ledPin, OUTPUT);

int x, y, z;
unsigned long time;
byte ledOn;

void loop() {
  if (rf12_canSend()) {
    x = analogRead(xPin);
    y = analogRead(yPin);
    z = analogRead(zPin);
    buf[0] = x >> 8;
    buf[1] = x;
    buf[2] = y >> 8;
    buf[3] = y;
    buf[4] = z >> 8;
    buf[5] = z;
    rf12_sendStart(0, buf, 6);
  if (time < millis()) {
    time = millis() + 200;
    if (ledOn) {
      digitalWrite(ledPin, HIGH);
    else {
      digitalWrite(ledPin, LOW);
    ledOn = !ledOn;

It’s really easy. You have to call the rfm12_recvDone() to make sure the driver is still working. You have to call it, even if you are not trying to receive anything. If rfm12_canSend() returns true, we can transmit our data. We read the 3 axis acceleration and pack it into a byte array. This byte array is then transmitted. No more, no less. No acknowledge, nothing.

The receiver part looks almost the same, it receives the data and prints it on the serial port. From here on, you can do almost anything: Processing, Pure Data, Python, what ever fits best. You only have to be able to read a serial port.


For the demo I used Processing to draw a graph of every acceleration value. The red one is a bit hard to see in the video. Then I used Python with pyglet to play short wave sounds.


3 generations of remote accelerometers

The picture above shows three generations of this device. On the left is the first implementation, using an XBee and an ADXL335, both on breakout boards, wired on a prototyping board. In the middle is the first custom PCB. As you can see, there are two air wires. That happens, when you get distracted while designing a PCB. On the right is the current version.

For the next design I would include an ON/OFF switch so you don’t have to pull off the battery all the time. And maybe add a small tactile button to make more Wii-like projects possible.

Downloads and Links

21 thoughts on “Remote Accelerometer

  1. I like Bruce :)
    About the voltage sensor, what do you use? Somehow I can’t find it in the schema..


  2. Very nice work — fantastic for only the second try I’d think!

    Did you do your hot-airing from the top or from the bottom (skillet-style)?

    If from the top, paste’s enough to keep the passives from blowing-away?



  3. I did it from the top. But I reduced the fan speed a bit. So no blowing away.
    Skillet style is another option that sounds good. Haven’t tried that.


  4. Great Project. Just wondering if the length of the wire matters. If so, what length did you use?


  5. The length of the wire matters. It is adapted to the wavelength lambda. The length of the antenna is lambda/4.
    300.000 km / 868 MHz = lambda = 0.3456 m
    => lambda/4 = 8.64 cm


  6. Pingback: Arduino Remote Accelerometer | Embeddedpub - Embedded Projects

  7. wow, cool beans – thinking of making something like this with the bluetooth chip they use in the wii-mote.

    I checked out your flickr set as well – those fireflies remind me of a setup I saw at burning man last year. All very fun stuff.


  8. Great job, I took your design and added a 2 axis gyroscope IZX 5000.
    I can send you the new eagle files if you want to build a 5 DOF sensor.
    Very small I like it.


  9. I do not have the facilities or ability to construct the board, but would be prepared to pay someone to do it for me.
    I would like to buy up to 5 units fully assembled.
    Anyone willing to do this.?


  10. ich habe gerade Deinen Artikel bei
    gelesen und finde das superinteressant!! Studiere zur Zeit Sound Studies an der UdK Berlin, wohne aber schon in Hamburg und muss nur noch meine Arbeit schreiben… Arbeite nun auch mit Pure Data… Habe mit dem Nunchuck Wii Controller experimentiert… Aber der Spukt in der Seriellen Schnittstelle solche Daten aus:

    die lassen sich nicht einfach in pure data anbinden. zumindest weiß ich nicht, wie ich das machen soll. Mit PDuino und dem Analogen Input wird nichts angezeigt…

    Wie habt ihr bei Eurem Projekt die Daten in Pure Data eingelesen? Hat der Beschleunigungssensor einfache analoge Werte ausgegeben?


  11. Nice project!

    What kind of batteries do you use? They look very small. How long does the accelerometer run on those batteries?


  12. What did you use to create the PCB? Did you send the design to a manufacturer or produced it by yourself?

    How did you managed to solder the tiny little chips?


  13. The board was processed by BatchPCB. The tiny SMT parts were placed by hand and then soldered with a hot air rework station.
    Works quite ok after a bit of practicing.


  14. Hey! Welche Station nutzt du denn und mit wieviel Grad betreibst du die? Habe demnächst auch vor ein SMD-Projekt zum Einstieg zu planen.


  15. great project, need to do something similar myself.
    i’m wondering if you tested for range at all?
    even with just the same setup you have would be most interesting.


  16. Hello, very good design. Do you have any measure of the latency ? we want to use it in a musical instrument, and we need the smallest latency. I f there is one, what could be done to improve the system ?
    thank you


Comments are closed.