Shop OBEX P1 Docs P2 Docs Learn Events
Punch Force Sensor — Parallax Forums

Punch Force Sensor

djwandjwan Posts: 5
edited 2011-10-25 07:14 in BASIC Stamp
Saw this guy using an Arduino to create a punch force sensor. Wanted to do the same thing using a BS2.

http://abieneman.wordpress.com/2010/04/04/punch-acceleration-sensor-%E2%80%93-part-2/

Bought the 250g x 1 axis accelerometer from Sparkfun and the ADC7680 16 bit ADC and breakout board for the ADC.

Using SHIFTIN command to read the data but need some help on the tweaks to make it usable data.

OK using the DEBUG terminal as the data display but will eventually migrate to a 2 x 16 LCD.

Comments

  • FranklinFranklin Posts: 4,747
    edited 2011-10-10 15:06
    Attaching your code will help us help you. Go to the advanced options and attach your stamp program.
  • ercoerco Posts: 20,256
    edited 2011-10-10 16:33
    Interesting application. Since it's a 1-axis sensor needed, you could use a piezo disk speaker as your accelerometer and measure the peak voltage spike for acceleration. Alternatively, for a poor man's non-accelerometer version, you could use a microphone and measure the volume of the punch.
  • djwandjwan Posts: 5
    edited 2011-10-10 18:25
    SHIFTINDJ.BS2

    @Franklin,

    OK. I think I have the file attached. I've been looking at the code for other accelerometers from Parallax and they are all multi axis. I can't seem to make heads or tails of the axis minus any value since this is a single axis and my experience is sparse at best. Any help would be greatly appreciated.

    Djwan
  • djwandjwan Posts: 5
    edited 2011-10-10 18:28
    erco, I've seen applications similar to what you describe. Search on Knockouter. I've considered this but I want to get familiar with this application and maybe apply what I learn to other areas of fitness.
  • FranklinFranklin Posts: 4,747
    edited 2011-10-10 21:39
    You are trying to store a 16 bit value from SHIFTIN to an 8bit variable (byte) You need to declare it a word variable.
  • djwandjwan Posts: 5
    edited 2011-10-12 18:38
    Hey Franklin. I changed the variable to a word. I also didn't have VDD and VSS ref voltages hooked up to the ADC7680. It finally dawned on me that the voltage input from the accelerometer didn't have anything to reference. New to ADC's. I get a constant return of the value 8191 even when I flick the accelerometer on the debug terminal. I checked the setup with a meter and everything seems to be connected and powered correctly. Trouble is, I have no idea how to translate the conversion formula into PBASIC from abieneman's blog as follows:
    Acceleration = (ADReading / 2^16 * 5 - 2.5) / 0.008
    Here, 2^15 is the maximum 16 bit value which corresponds to the analog voltage of 5V, 2.5 is the no-acceleration value and 0.008 is sensitivity volts per g.

    Thanks for your help.
  • djwandjwan Posts: 5
    edited 2011-10-25 07:14
    It looks as if there was a solder bridge on the SMT ADC breakout. Finally thought to swap in the spare and it returned values of 4090 steady straight up to 4125 when held steady at 90° from straight up. Then shook very hard and got returns of 4296.

    Question is how do I make sense of the values?
    Is it simply a decimal value that can be calibrated by saying that 4090=0g and 4296=206g?
Sign In or Register to comment.