Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
09.02.2010 at 17:18:26
News: Server upgrade went fine, you are now at the new system


Pages: 1
MiniPOV with Accelerometer !! (Read 6514 times)
Param Aggarwal
Ex Member




MiniPOV with Accelerometer !!
08.10.2008 at 08:05:59
 


I needed some way to make a MiniPOV detect when I waved it in the air. So what do you use? An Accelerometer !!

So what I do is that I fix an Accelerometer to the good old 10-segment
display ( it has 10 green LED's put into a single component! ). And
use an Arduino to control it.




So there you have it. As you wave it, it senses this motion and
switches ON the display. And one another benefit that I was really
looking for is that it writes only from left to right. I mean when you
wave your hand it goes left to right to left. Right? My old AccPOV was
amateur enough to keep displaying text all the time left to right and
back too. So that has been eliminated. And its so cool now !

I am calling it the AccPOV that is a accelerometer based Persistence
of Vision Display. Idea of Accelerometer was completely mine, ( deleted: and haven't found it on the net ). Code in C++ attached. You need Arduino
Software to compile it.


Update: I DO NOT mean to say that I am the first one to do this. And yes there are lots of people who have done this thing. Even commercial products have this. I just wanted to say that it struck me that this could be done and so I did it. No copying from here. Though I could have done so very easily due to so many resources on the net !!





The Blue Board is the Arduino Decimelia. It programs and takes power
from the USB ( the grey wire ).




The General Purpose PCB is a 'shield'
which is the word used for attachment boards created for the Arduino.
I have mounted the display on that.





Then the tiny green PCB on the
side is the Accelerometer Board. So that's it. Took one and half day
to materialize.

Next I plan to use RGB LED's to be able to see 6 colors !! So that
should be fun...

Thanks for Reading !! I know it all sounds too formal, as if I am
selling something. But it's just a discussion. A concept...

In case you don't get the heck what I am talking about read this: This
project uses Persistence of Vision. So I can use just 8 LED's (Yes, I
am just using 8 of them. ) to display text. Now as you wave it in the
air, the 8 LEDs quickly change states to appear as if something is
written in the air. It gives superb effect in the dark. For effect in
the daylight I need very bright LEDs... So as simple as that. Just
wave and read.




You can mail me at paramaggarwal@gmail.com for criticism and comments.


Accelerometer:

Three axis accelerometer from Freescale that gives analog voltage
proportional to acceleration. You measure that voltage using a
micro controller and you get acceleration!!

Controller Board:

Arduino's are so easy !! More info about them here: http://www.arduino.cc It
is based on the ATMEGA168 with bootloader.

Have a look at http://www.sparkfun.com for some great Electronics Tutorials.


Code:
Code:

/*****************

Written by Param Aggarwal
Feemo Electronics


AccPOV

Uses an accelerometer to sense when it is being waved in the air.

Uses Arduino Decimilia and Accelerometer and a custom made shield for the Arduino.

*******************/

/********** Headers ************/

#include<avr/pgmspace.h>

/********* Pins ***********/

// Display goes on PORTD

// GS1 on 10 Sensitivity Selection pins
// GS2 on 11 +- 4g selected here
//SLEEP on 12 and active LOW

int GS1 = 10;
int GS2 = 11;
int SLEEP = 12;

int Y=0; // Temp
int p=0; //Temp

// Tells the microcontroller how to write letters. Little Kid.

// Taken from Sparkfun Library
int text_array[475] = {
0x00,0x00,0x00,0x00,0x00,/*space*/ // is 32 in ASCII
0x00,0xF6,0xF6,0x00,0x00,/*!*/
0x00,0xE0,0x00,0xE0,0x00,/*"*/
0x28,0xFE,0x28,0xFE,0x28,/*#*/
0x00,0x64,0xD6,0x54,0x08,/*$*/
0xC2,0xCC,0x10,0x26,0xC6,/*%*/
0x4C,0xB2,0x92,0x6C,0x0A,/*&*/
0x00,0x00,0xE0,0x00,0x00,/*'*/
0x00,0x38,0x44,0x82,0x00,/*(*/
0x00,0x82,0x44,0x38,0x00,/*)*/
0x88,0x50,0xF8,0x50,0x88,/***/
0x08,0x08,0x3E,0x08,0x08,/*+*/
0x00,0x00,0x05,0x06,0x00,/*,*/
0x08,0x08,0x08,0x08,0x08,/*-*/
0x00,0x00,0x06,0x06,0x00,/*.*/
0x02,0x0C,0x10,0x60,0x80,/*/*/
0x7C,0x8A,0x92,0xA2,0x7C,/*0*/
0x00,0x42,0xFE,0x02,0x00,/*1*/
0x42,0x86,0x8A,0x92,0x62,/*2*/
0x44,0x82,0x92,0x92,0x6C,/*3*/
0x10,0x30,0x50,0xFE,0x10,/*4*/
0xE4,0xA2,0xA2,0xA2,0x9C,/*5*/
0x3C,0x52,0x92,0x92,0x0C,/*6*/
0x80,0x86,0x98,0xE0,0x80,/*7*/
0x6C,0x92,0x92,0x92,0x6C,/*8*/
0x60,0x92,0x92,0x94,0x78,/*9*/
0x00,0x00,0x36,0x36,0x00,/*:*/
0x00,0x00,0x35,0x36,0x00,/*;*/
0x10,0x28,0x44,0x82,0x00,/*<*/
0x28,0x28,0x28,0x28,0x28,/*=*/
0x00,0x82,0x44,0x28,0x10,/*>*/
0x40,0x80,0x8A,0x90,0x60,/*?*/
0x7C,0x82,0xBA,0xBA,0x62,/*@*/
0x3E,0x48,0x88,0x48,0x3E,/*A*/
0xFE,0x92,0x92,0x92,0x6C,/*B*/
0x7C,0x82,0x82,0x82,0x44,/*C*/
0xFE,0x82,0x82,0x82,0x7C,/*D*/
0xFE,0x92,0x92,0x92,0x82,/*E*/
0xFE,0x90,0x90,0x90,0x80,/*F*/
0x7C,0x82,0x82,0x8A,0x4E,/*G*/
0xFE,0x10,0x10,0x10,0xFE,/*H*/
0x82,0x82,0xFE,0x82,0x82,/*I*/
0x84,0x82,0xFC,0x80,0x80,/*J*/
0xFE,0x10,0x28,0x44,0x82,/*K*/
0xFE,0x02,0x02,0x02,0x02,/*L*/
0xFE,0x40,0x20,0x40,0xFE,/*M*/
0xFE,0x60,0x10,0x0C,0xFE,/*N*/
0x7C,0x82,0x82,0x82,0x7C,/*O*/
0xFE,0x90,0x90,0x90,0x60,/*P*/
0x7C,0x82,0x82,0x86,0x7E,/*Q*/
0xFE,0x90,0x98,0x94,0x62,/*R*/
0x64,0x92,0x92,0x92,0x4C,/*S*/
0x80,0x80,0xFE,0x80,0x80,/*T*/
0xFC,0x02,0x02,0x02,0xFC,/*U*/
0xF8,0x04,0x02,0x04,0xF8,/*V*/
0xFC,0x02,0x0C,0x02,0xFC,/*W*/
0xC6,0x28,0x10,0x28,0xC6,/*X*/
0xC0,0x20,0x1E,0x20,0xC0,/*Y*/
0x86,0x8A,0x92,0xA2,0xC2,/*Z*/
0x00,0x00,0xFE,0x82,0x00,/*[*/
0x00,0x00,0x00,0x00,0x00,/*this should be / */
0x80,0x60,0x10,0x0C,0x02,/*]*/
0x20,0x40,0x80,0x40,0x20,/*^*/
0x01,0x01,0x01,0x01,0x01,/*_*/
0x80,0x40,0x20,0x00,0x00,/*`*/
0x04,0x2A,0x2A,0x2A,0x1E,/*a*/
0xFE,0x12,0x22,0x22,0x1C,/*b*/
0x1C,0x22,0x22,0x22,0x14,/*c*/
0x1C,0x22,0x22,0x12,0xFE,/*d*/
0x1C,0x2A,0x2A,0x2A,0x18,/*e*/
0x10,0x7E,0x90,0x80,0x40,/*f*/
0x18,0x25,0x25,0x25,0x1E,/*g*/
0xFE,0x10,0x10,0x10,0x0E,/*h*/
0x00,0x12,0x5E,0x02,0x00,/*i*/
0x02,0x01,0x01,0x11,0x5E,/*j*/
0xFE,0x08,0x08,0x14,0x22,/*k*/
0x00,0x82,0xFE,0x02,0x00,/*l*/
0x3E,0x20,0x1C,0x20,0x1E,/*m*/
0x3E,0x20,0x20,0x20,0x1E,/*n*/
0x1C,0x22,0x22,0x22,0x1C,/*o*/
0x3F,0x24,0x24,0x24,0x18,/*p*/
0x18,0x24,0x24,0x3F,0x01,/*q*/
0x3E,0x10,0x20,0x20,0x10,/*r*/
0x12,0x2A,0x2A,0x2A,0x04,/*s*/
0x00,0x10,0x3C,0x12,0x04,/*t*/
0x3C,0x02,0x02,0x02,0x3E,/*u*/
0x30,0x0C,0x02,0x0C,0x30,/*v*/
0x38,0x06,0x18,0x06,0x38,/*w*/
0x22,0x14,0x08,0x14,0x22,/*x*/
0x38,0x05,0x05,0x05,0x3E,/*y*/
0x22,0x26,0x2A,0x32,0x22,/*z*/
0x00,0x10,0x6C,0x82,0x82,/*{*/
//0x00,0x00,0xFF,0x00,0x00,/*|*/
0x04,0x02,0xFF,0x02,0x04,/*|, arrow*/
0x82,0x82,0x6C,0x10,0x00,/*}*/
0x08,0x10,0x18,0x08,0x10/*~*/
};


// Displays the text
void display(char c)
{
int i = (c - 32)*5;
for ( int temp = i; temp < i + 5; temp++ )
{
PORTD = text_array[temp]; delayMicroseconds(500);
PORTD = 0x00; delay(3);
}
PORTD = 0x00; delay(3);
}


void setup()
{
pinMode(0,OUTPUT); // Set display as OUTPUT
pinMode(1,OUTPUT);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);

digitalWrite(GS1,HIGH); // Sensitivity Select
digitalWrite(GS2,LOW);
digitalWrite(SLEEP,HIGH); // Don't let the Accelerometer sleep !!!
}

void loop()
{
Y = analogRead(1); // Read the sensor...
if ( Y > 650)
{
p++;
if(p=2) // Take alternate acceleration...
{
p=0;
delay(60); // Wait a moment before starting


display('P'); // Paaaaraaammm...
display('a');
display('r');
display('a');
display('m');
display(':');
display('-');
display(')');
display(' ');
}
}
} 

Back to top
 
« Last Edit: 08.10.2008 at 11:25:19 by paramaggarwal »  
  IP Logged
mem
God Member
*****
Online

Have fun!

Posts: 5415
London
Re: MiniPOV with Accelerometer !!
Reply #1 - 08.10.2008 at 08:58:46
 
Hi Param, nice project, thanks for sharing.

You can’t have much RAM spare with that giant text array. If you are considering any enhancements to your sketch, you can halve the RAM usage by changing the text array from ints to a bytes

byte text_array[475] = {
Back to top
 
 
View Profile   IP Logged
Param Aggarwal
Ex Member




Re: MiniPOV with Accelerometer !!
Reply #2 - 08.10.2008 at 11:10:13
 
Hey mem, thanks!

Thats an interesting suggestion from you! Never thought of it. Just copy pasted that library....
Back to top
 
 
  IP Logged
mem
God Member
*****
Online

Have fun!

Posts: 5415
London
Re: MiniPOV with Accelerometer !!
Reply #3 - 08.10.2008 at 11:38:33
 
Happy to help. If you ever need to, you can further reduce the RAM consumption with progmem, see the Arduino reference for info on how to do this: http://www.arduino.cc/en/Reference/PROGMEM

This could come in handy if you decide you want to add lots of strings to your application.

Have fun!
Back to top
 
 
View Profile   IP Logged
Syvwlch
Full Member
***
Offline

Ard at work

Posts: 192
New Jersey
Gender: male
Re: MiniPOV with Accelerometer !!
Reply #4 - 08.10.2008 at 13:41:13
 
Nice twist on the POV, thanks for sharing!  Smiley
Back to top
 
 
View Profile | WWW   IP Logged
Grumpy_Mike
God Member
*****
Online

Solder is electric
glue

Posts: 5197
Manchester (England England)
Gender: male
Re: MiniPOV with Accelerometer !!
Reply #5 - 08.10.2008 at 15:36:04
 
That's a modern twist. I made one of these in the 80s and I used a mercury switch sloshing about to detect the change in direction, but you are not aloud to use mercury any more Sad (at least in Europe)
Back to top
 
 
View Profile | WWW   IP Logged
myozone
Junior Member
**
Offline

Arduino rocks

Posts: 68
Shropshire UK
Gender: male
Re: MiniPOV with Accelerometer !!
Reply #6 - 09.10.2008 at 17:03:16
 
I did the same thing with a 'BBC B', used a micro switch with a large bit of card to trigger from the air flow.... those where the days  Undecided Cry
Back to top
 
 
View Profile   IP Logged
Param Aggarwal
Ex Member




Re: MiniPOV with Accelerometer !!
Reply #7 - 09.10.2008 at 17:42:19
 
Hey guys, I love the reponse!!!
I have even been blogged on MAKE!
Considering the fact that I am just 18yrs old, I definitely feel proud!
Thanks everyone!

@myozone & @Grumpy_Mike
Ya, even I read about an idea to put some solder blob on a piece of guitar string and have it sense the jerk. But why not do it the high tech way!!

@Syvwlch
Thanks...

@mem
I was using progmem but it was causing problems, I mean to the extent of displaying rubbish... I never found out the reason...

Blog on MAKE: http://blog.makezine.com/archive/2008/10/arduino_minipov_with_acce.html

My Site: http://www.feemoelectronics.com
Back to top
 
 
  IP Logged
mem
God Member
*****
Online

Have fun!

Posts: 5415
London
Re: MiniPOV with Accelerometer !!
Reply #8 - 09.10.2008 at 18:23:00
 
Quote:
I was using progmem but it was causing problems, I mean to the extent of displaying rubbish... I never found out the reason...
If you want to fix it, post the code and I am sure someone here will help you out with it.
Back to top
 
 
View Profile   IP Logged
Param Aggarwal
Ex Member




Re: MiniPOV with Accelerometer !!
Reply #9 - 09.10.2008 at 18:25:38
 
@mem,

In the code above instead of

int text_array[475]

I used

int PROGMEM text_array[475]

and included the header file too...
Back to top
 
 
  IP Logged
mem
God Member
*****
Online

Have fun!

Posts: 5415
London
Re: MiniPOV with Accelerometer !!
Reply #10 - 09.10.2008 at 18:56:43
 
isn't your array now bytes instead of ints?

try  PROGMEM byte text_array[475]

Back to top
 
 
View Profile   IP Logged
Param Aggarwal
Ex Member




Re: MiniPOV with Accelerometer !!
Reply #11 - 10.10.2008 at 05:55:33
 
@mem

okie... i'll try that!
Back to top
 
 
  IP Logged
Grumpy_Mike
God Member
*****
Online

Solder is electric
glue

Posts: 5197
Manchester (England England)
Gender: male
Re: MiniPOV with Accelerometer !!
Reply #12 - 10.10.2008 at 11:25:20
 
myzone
Quote:
I did the same thing with a 'BBC B', used a micro switch with a large bit of card to trigger from the air flow.... those where the day


Well I wrote this article in 1989 for the BBC micro with the mercury switch:-

http://www.doc.mmu.ac.uk/STAFF/A.Wiseman/Acorn/BodyBuild/BB89.html
Back to top
 
 
View Profile | WWW   IP Logged
Pages: 1