Skip to main content
Topic: USB POV/Accelerometer Toy (Read 64640 times) previous topic - next topic

USB POV/Accelerometer Toy

I have seen several POV toys around the internet. One of these is http://www.ladyada.net/make/minipov3/

However, most of those are not capable of sensing the speed/direction when waved in the air. Most are also not easily programmable and require some modification to the source code of the microcontroller used just to change the image/message displayed in the air.

I was thinking of using a cheap USB PIC (PIC18F14K50/PIC18LF14K50 @ around 2USD each) and  a cheap accelerometer sensor (MMA7455L @around 2USD each as well). The accelerometer can be used to detect wave direction to avoid a "mirrored" display and to adjust the delay between each frame of the image/message. The USB PIC, as a CDC device, can be easily programmed by a new message using a customized software or a terminal program. The message/image can be saved to the PIC's internal EEPROM.

Being a USB capable device with accelerometer, it can be used to other applications like http://www.starlino.com/usb_thumb_imu.html and http://www.starlino.com/usb_gamepad.html

I have here eagle files as a starting point for this project

Re: USB POV/Accelerometer Toy

Reply #1
Looks good. I'd recommend the resistor array we used on the Bus Pirate v4 to save space, if the arrays can handle the current.

Maybe T 1 3/4 LEDs? Are there any POVs with SMD LED? Will it be bright enough? If we go SMD maybe we can do the LEDs on both sides of the PCB.

CDC USB would be great, we almost have an open source driver now. Then it can work with the existing POV animation software that's out there.

Another thing to consider is using the 18F24J50 from the Logic Sniffer. That consolidates our parts for better bulk pricing, and we already have the USB bootloader and tools for it. An external EEPROM would be needed. It is 3.3volts, which is better for batteries, but maybe worse for the LEDs?
Got a question? Please ask in the forum for the fastest answers.

Re: USB POV/Accelerometer Toy

Reply #2
A resistor array is a good idea.

I was also thinking of using  a through-hole LED until I see the PSoC® 3 FirstTouchâ„¢ Starter Kit (Part # CY8CKIT-003). It has a POV demo and it uses SMD LEDs.

I love the idea of doing SMD LEDs on both sides of the PCB. A resolution of 16-LEDs will do as well as it offers more resolution to do graphical animation

By the way, the circuit that I started runs on 3.3V because the sensor is a 3.3-volt chip

Re: USB POV/Accelerometer Toy

Reply #3
If you put LEDs on both sides, you don't hurt yourself trying to watch the animation :)
Got a question? Please ask in the forum for the fastest answers.

Re: USB POV/Accelerometer Toy

Reply #4
but the animation on one side must not be a mirror image/animation of the other side

Re: USB POV/Accelerometer Toy

Reply #5
Ah, I didn't think about that....
Got a question? Please ask in the forum for the fastest answers.

Re: USB POV/Accelerometer Toy

Reply #6
[quote author="ian"]Will it be bright enough? If we go SMD maybe we can do the LEDs on both sides of the PCB.[/quote]SMD LEDs can be too bright to stare at, but I haven't really tried staring at through-hole LEDs for the same length of time for comparison.  Through-hole might allow super-bright options for long-distance POV performance, but it seems there are plenty of super-bright SMD LEDs, too.

Quote
Another thing to consider is using the 18F24J50 from the Logic Sniffer. ... It is 3.3volts, which is better for batteries, but maybe worse for the LEDs?
There are a lot of MAXIM chips which can boost 3.3V enough to exceed the 3.6V or higher Vf of blue and white LEDs, and many of them work with a simple SMD capacitor instead of an inductor.  The only disadvantage of the cap-based boost supplies is that they seem to be less efficient when the input voltage is higher (like 5V), although they work great with 3.3V - shouldn't be a problem here.

Looks like the PIC18F24J50 has 5V-tolerant port output pins, but in case they aren't you can use high-current FETs to switch the boosted supply for each LED individually.  This FET solution also gets you way beyond the 25 mA limit of port B and C, even if you don't need the voltage boost.

Re: USB POV/Accelerometer Toy

Reply #7
I actually have a prototype similar to this but it uses ATtiny2313. It has no direction and speed sensing capability.  The delay between frames is constant that is why I always should wave the protoype in the proper speed.

The animation is saved in the ATTiny2313's internal EEPROM and I use a USB-to-serial  converter to reprogram the animation.

The prototype sits perfectly on a 2xAA battery holder.

I also have a customized software for that one.

Re: USB POV/Accelerometer Toy

Reply #8
Have a similar thing built with PIC 16F84A. Ahh, good old days! Had to change the message to a heart as my gf got mad at me because I was working on the circuit & program instead of listening to her. :)

You cannot measure speed with an accelerometer, you can only find how the board is oriented. Also you might sense the direction change with the jerk but that might be problematic. Maybe a single axis gyro? As you will wave the circuit, you will cause it to rotate a little, this might be used to find both direction and speed.

Re: USB POV/Accelerometer Toy

Reply #9
I built the same with a 16F628a with the same results :)
Got a question? Please ask in the forum for the fastest answers.

Re: USB POV/Accelerometer Toy

Reply #10
[quote author="tayken"]
You cannot measure speed with an accelerometer, you can only find how the board is oriented. Also you might sense the direction change with the jerk but that might be problematic. ...
[/quote]
I like this project idea! :)

For details on accelerometers: You can derive speed from acceleration a(t) dv(t)/dt --> dv(t) = a(t) * dt
I am not sure how you'd determine the orientation with an accelerometer only - so you may determine the direction of movement relative to the starting point.

Anyway, with some simple assumptions you may make this work with a 2-axis accelerometer like Cypress in their PSoC3 and PSoC5 FirstTouch Starter Kits:

http://www.cypress.com/?rID=43674

Watch the end of the video ;)

Re: USB POV/Accelerometer Toy

Reply #11
[quote author="IPenguin"]
For details on accelerometers: You can derive speed from acceleration a(t) = dv(t)/dt --> dv(t) = a(t) * dt
I am not sure how you'd determine the orientation with an accelerometer only - so you may determine the direction of movement relative to the starting point.
[/quote]

Yep the math is correct but in reality this is problematic. Accelerometers give out noisy signal outputs, and using the derivative or integral of a noisy signal is not a good idea as there are large errors. They caused lots and lots of problems during my research on UAVs: bias voltage, high sensitivity to vibrations, scaling etc. You can of course use some kind of filter but this will delay your response.

Re: USB POV/Accelerometer Toy

Reply #12
In my past life I designed military gimbal systems.  We used two types of sensors Solid State Gyros/Accelerometers and Fiber Optic Gyros.  There is no question that the Solid State Gyros were noisy but we were able to use them in a gimbal system to keep the weapon on the target.  The trick is in the number of samples and being to filter out the "flyers".  It takes a mathmatical filter not a electronic filter.  The code that was used is proprietary but they are examples out there.

The Fiber Optic Gyros were awesome in performance and expense.  We used them on very special sensor gimbals. 

I have a use for the Accelerometer part of the project.  I would like to make a little box that determines the speed based on acceleration.  Here in Taiwan we have all kinds of trains, some Bullet Trains, standard and MRT.  The MRT acceleration is very fast and I would like to know how fast they go.  The Bullet Trains have a display that tells you how fast.  They peak at about 300kph.
"Too many projects, so little time"

Re: USB POV/Accelerometer Toy

Reply #13
Yeah, fiber optics are awesome! Used them during my internship at a defense company, really cool stuff! We had to use the IMU from Spakfun (don't tell me, ask my professor) and had to implement a Kalman filter for it. He was kind of picky about using software implemented LPF or any other filter without using an electronic LPF.

Actually I want something similar too. I want to build an IMU for an Unmanned Ground Vehicle that I have in mind for some dead-reckoning. But this also requires some gyros and an electronic compass.

Re: USB POV/Accelerometer Toy

Reply #14
[quote author="tayken"]
Yeah, fiber optics are awesome! Used them during my internship at a defense company, really cool stuff! We had to use the IMU from Spakfun (don't tell me, ask my professor) and had to implement a Kalman filter for it. He was kind of picky about using software implemented LPF or any other filter without using an electronic LPF.

Actually I want something similar too. I want to build an IMU for an Unmanned Ground Vehicle that I have in mind for some dead-reckoning. But this also requires some gyros and an electronic compass.
[/quote]

Maybe we need to talk.
"Too many projects, so little time"