JM badge board, logging and/or monitoring of the accelerometer data

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

JM badge board, logging and/or monitoring of the accelerometer data

1,881 Views
stelvio
Contributor I

Hello,

I have a JM Badge board and hope to use it for a high school
physics project.  I have a rudimentary background in embedded
programming, but am not especially proficient ... yet!  So far,
I've worked my way through the various demo programs, and
a bunch of USB-related app notes (for some of the other eval
boards).

I simply want to log around 60 seconds of accelerometer data,
preferably to a textfile on the PC, or to a USB stick. But it looks like the
safest approach might be to follow the "Read and Write SD Card"
documentation (Data Logger demo).  But assuming the Badge
Board remains USB-attached to my laptop, isn't there an even
more straightforward way ?  Nothing fancy for now -- any advice
or guidance is welcome. For example, of the Badge demo
programs, I believe the HID/mouse is a good starting point.






Labels (1)
0 Kudos
Reply
4 Replies

562 Views
RichTestardi
Senior Contributor II
Hi,
 
If you download the badge board version of StickOS from:
 
 
You can then log in to the badge board using a dumb terminal emulator (like HyperTerminal) and enter and run the following program to gather accelerometer data:
 
  10 dim x as pin ptb4 for analog input
  20 dim y as pin ptb5 for analog input
  30 dim z as pin ptb6 for analog input
  40 dim gsel1 as pin ptc4 for digital output
  50 dim gsel2 as pin ptc5 for digital output
  60 dim wake as pin ptc3 for digital output
  70 let gsel1 = 0
  80 let gsel2 = 0
  90 let wake = 1
 100 while 1 do
 110   print "x =", x, "; y =", y, "; z =", z
 120   sleep 1 s
 130 endwhile
 
You can see a screenshot of how easy it is, attached.
 
There is full documentation on the website download page (including a quick reference guide to the BASIC commands and statements), as well as some Badge Board specific commands listed on this page:
 
 
I'm happy to help -- my goal is to eventually target the High School/University students with this technology.
 
-- Rich
 
0 Kudos
Reply

562 Views
stelvio
Contributor I
Rich,

This (StickOS) is the ticket ... pretty much EXACTLY what
I was hoping to discover. Thanks a million - guess I will now
need to calibrate the ADC and figure out how these integers
relate to movement of the JMBadge. And read your manual.
Then, off I go to the local see-saw and merry-go-round!

>  100 while 1 do                 
>  110   print "x =", x, "; y =", y, "; z =", z                                               
>  120   sleep 1 s                  
>  130 endwhile               
> save      
> run     
x = 3291 ; y = 1623 ; z = 1175                              
x = 1499 ; y = 1609 ; z = 1135                              
x = 1505 ; y = 1616 ; z = 1136                              
x = 1499 ; y = 1613 ; z = 1127                              
x = 1513 ; y = 1617 ; z = 1129                              
x = 1512 ; y = 1623 ; z = 1128                              
x = 1504 ; y = 1616 ; z = 1117                              
x = 1505 ; y = 1614 ; z = 1137                              
x = 1505 ; y = 1613 ; z = 1128                              

0 Kudos
Reply

562 Views
RichTestardi
Senior Contributor II
I'm glad it is working for you!
 
The numbers you get from the adc pin variable is millivolts, and the accelerometer is calibrated such that 1.65V (1650mV) is 0-G in each axis...  The sensitivity, in mV/G is set by the gsel1/gsel2 pins to be either 800, 600, 300, or 200 mV/G.  If you set gsel1/gsel2 to 0 as I have, you're reading 800mV/G.
 
One word of warning on the program I sent to you -- you probably want to delay before the first measurement after setting the gsel1/gsel2/wake pins -- otherwise the very first reading is out of whack with the others.
 
You can also turn on a simple low-pass filter on the analog inputs with the "debounced" pin qualifier, like:
 
10 dim x as pin ptb4 for analog input debounced

 

Have fun!  If you need any missing features or anything, just let me know -- this stuff is changing daily right now while I'm between jobs! :smileyhappy:

 
-- Rich
 
 
0 Kudos
Reply

562 Views
RichTestardi
Senior Contributor II
And as a purely entertaining use of the badge board, you can try out this paddleball game that uses the accelerometer and buzzer...  It might give you other ideas of how you can use the StickOS language and badge board peripherals/display, etc.
 
0 Kudos
Reply