Air Wand Design

This project is just an excuse to use the ADXL345 accelerometer and, hopefully, a bluetooth module. The accelerometer is used to determine the motions that the user is making. That information is use by the application program to control the illumination of the LEDs so that they dispaly a POV (Persistence Of Vision) light message in the air. The bluetooth will be used as a development aid to get real-time accelerometer data from the moving wand so we can see what the “numbers look like”. There may possibly be an application for the bluetooth in the normal use of the wand.

I have seen many POV LED projects on youtube. A few of them come with reasonable explanations and access to schematics and code. But not very many. Ususally there is some rotating structure with position sensors that allow syncing the LEDs to the motion of the structure. This seems like a fairly simple problem to solve. Getting interesting displays is probably the most complicated part of the problem. Storing data, modifying data, and transmiting data can be challanging. But it’s not the part I want to concentrate on. My main motivation is to explore the ADXL345 accelerometer for future use in an airborne device of some type. So, the ADXL345 will take the place of something like a simple IR transmitter/detector for synchronization. The accelerometer will allow freedom of motion in at least 2 planes. I also wanted to be able to get data from the accelerometer into some form of permanent record. After fooling around looking at the requirements for a cabled-up RS232 it struck me that bluetooth would be useful for both this project and the airborne platform in the future.

The design is going to be string of LEDs (8 or 9) in a row, the accelerometer to detect motion, bluetooth to interface the accelerometer data, and a PIC 18F2550 to contol the whole thing. The use of LEDs is to attract attention to the project and to give visual feedback on the dynamics of using the accelerometer. Here is a tenative schematic:

Air Wand Schematic

Baby Step One

This is my first major project with a PIC 18F2550 so it’s going to be in assembly language. I want to take this opportunity to become very familiar with the operation of this controller. As things get more advanced, I may switch over to C. The major code I’ll be writing now is going be similar to device drivers, so there is a good chance that I can keep most of the assembly and write C for the “system” level control. We’ll just see how it goes.

The video shows using the ADXL345 on a breadboard, along with an LCD display to show real-time data. I moronically pound on the breadboard just to get the numbers to jump around. Ideally, I should have tilted the breadboard along the X, Y, and Z axes, but I did not think to provide a long enough power lead. What a dummy. I would have also had to secure the LCD display, and that would have taken too many resources. The video is already in-the-can but there will be opportunity see those numbers in the future. For now, I know the basic circuit is working. The code is available for download here. It will unzip into a directory named AirWand/.

This code has a problem with the LCD display. I have tried to fix it, but have not been sucessful at all. There are a couple of extra characters on the display, and after the first test pass, the X data shows up on the beginning of the Y data line. I have no clue what causes this. Since the LCD is only for debugging, I’m not going to worry about this. The LCD will not be part of the circuit in future installments of this project. Sorry for any inconvienience.

Download Air Wand Baby Step One: air_wand_1.zip



©copyright 2015 pretzelogic LLC. All rights reserved.
No part of this page may be reproduced without permission.
Software, schematics, and text are presented as reference works only.
No claim as to useability, suitability, or correctness for any application is made.