Ferrocen,
Thank you for the suggestion. I checked X-IMU, but can not find how it could help in my case?
Actually I'm implementing something else:
Sensor would be inside hexagonal dice. Each side of dice would have it's own led diodes around the corners (so it is easily seen when landed). In the dice would be mpu6050 (or similar), stripped down arduino nano running at 8Mhz, 3.3V and led (or more of them) for each dice side.
When dice would land, Arduino (with help of MPU6050) would turn on leds around the dice side on which it landed.
I have quite a few challenges here:
No way to shut off electronics - no switches
Circuit is placed inside the dice. There is a way to change batteries with unscrewing some "sides", but it is too complicated to do it each time dice is used.
There are 3 AAA batteries inside. They should last at lease few weeks when in sleep mode.
when dice is not in use, Arduino and MPU should go to sleep mode.
Arduino would go to sleep mode if it won't receive interrupt from MPU for some time.
MPU would go to cycle mode when there is no movement.
Arduino would wake up when next interrupt would be received from MPU.
MPU would wake up on first movement above threshold.
This is where I'm facing two problems:
- MPU is sending moving interrupts even if it is standing still on my table.
- If I enable cycle mode I get "DMP Initialization failed (code 1)"
sampling rate of MPU can be low as possible (if that would effect battery life)
For this particular project it would be enough if MPU would measure it's position 1times/second - dice land and after a sec yaw, pitch and roll is read and appropriate LEDs are turned on.
I was experimenting with this and found out that if I set sampling to slowest possible B11111111, MPU readings become strange - like it is not detecting that circuit was moved.
From my examples I guess lowering sampling rate is not a good idea. What do you think?
calibration can be done only once (when circuit is assembled).
I don't need great accuracy to find out on which side dice has landed.
But it needs to be stable and with out drifting.
How I see calibration process:
1. Assembled circuit is placed on perfectly flat surface.
2. dedicated pins are shorten on Arduino which triggers calibration procedure.
3. calibration procedure reads current MPU position and set it as offset - so current position (ypr) would be 0,0,0
The biggest problem at the moment is how to enable cycle mode and properly configure interrupts (there could also be possibility that my MPU is broken).
I would need a way to find out what is triggering motion interrupt.
Any suggestion?