Hello All,
I've been struggling the last 2 weeks now with my sketch and I just can't seem to figure it out.
My goal is the make an airplane G-Meter using:
- 5V trinket
- ADXL 326
- Neopixel strip
What I have done so far:
- Adafruit ADXL3## Programming I have run this calibration sketch but I am completely confused on how I find the max and min raw values for a +-16G sensor. I have been able to calibrate to read out 0.00G X / 0.00G Y and 1.00G Z but does this not only calibrate my max and min values for 1G and not for +-16G? Furthermore why is my scaling not 0 - 1023 for max and min values?
For 1G Z my values are zRawMin 498 and zRawMax 538.
These values are 40 apart with 512 to 538 being 26
and
512 to 498 being 14
When I try to scale accordingly to 2G I take 498 - 14 = 484 and 538 + 26 = 564
After doing this my Z no longer calibrates to 1G it gives me some random positive value 0.40G.
All this being said do I even need to run a calibration sketch? If the scaling is linear should I not be able to take my analogRead(A0) analogRead(A1) analogRead(A2) values and output them directly to a G value?
for example (using 0 - 1023 scaling)
+2G = 576 raw value and -2G = 447 raw value
See link below for how I get raw values.
Overall my goal is to have the neopixel LED's light up in sequence (only planning on using strip of 10) when experiencing G forces.
Goal would be a case break to do this:
case 1
1G - show #0 LED
case 2
2G - show #0 LED and #1 LED
case 3
3G - show #0 / #1 and #2 LED
Does this all make sense?
End result should be something similar to the red bull air race G-meter.
Air Race Cockpit