Hi
I have a simple neopixel sketch running 60 LEDs from my Flora. In addition I want to read XY and Z data from my L3GD20h , and use that data to:
1) alter certain LED variables - and
2) trigger sounds on the Sound Board
Is this possible?
If so, could you show me a simple sketch including the relevant libraries, and establishing comms between boards?
Many thanks
Steve
Flora - L3GD20h - Sound Board - can I hook em up....
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- evansson
- Posts: 7
- Joined: Mon Mar 02, 2015 5:48 am
Flora - L3GD20h - Sound Board - can I hook em up....
- Attachments
-
- i have a few free pins left on the flora...
- photo.JPG (649.97 KiB) Viewed 584 times
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Flora - L3GD20h - Sound Board - can I hook em up....
It's possible, but I don't know of any examples.
The output from the L3GD20 will be numeric, and you'll use those numbers to create other patterns of numbers for the NeoPixels and FX Board. There are countless ways to do that, but the devices don't need to know anything about each other. You could replace the gyro with pushbuttons and the NeoPixels wouldn't care.
To control the FX Board, connect pins on the Flora to trigger pins on the FX Board and set the Flora's output to LOW for the pin you want. You need to hold the pin LOW for about a quarter of a second, but that's all the FX Board cares about.
The technical term for it is 'loose coupling', where 'coupling' means "how much do these devices need to know about each other in order to work?" For those three devices, the answer is, "not at all". You can go through the tutorials for each device by itself, and play around writing code for each device independently, and you won't need to learn anything more to put them together.
The output from the L3GD20 will be numeric, and you'll use those numbers to create other patterns of numbers for the NeoPixels and FX Board. There are countless ways to do that, but the devices don't need to know anything about each other. You could replace the gyro with pushbuttons and the NeoPixels wouldn't care.
To control the FX Board, connect pins on the Flora to trigger pins on the FX Board and set the Flora's output to LOW for the pin you want. You need to hold the pin LOW for about a quarter of a second, but that's all the FX Board cares about.
The technical term for it is 'loose coupling', where 'coupling' means "how much do these devices need to know about each other in order to work?" For those three devices, the answer is, "not at all". You can go through the tutorials for each device by itself, and play around writing code for each device independently, and you won't need to learn anything more to put them together.
- evansson
- Posts: 7
- Joined: Mon Mar 02, 2015 5:48 am
Re: Flora - L3GD20h - Sound Board - can I hook em up....
Thanks Mike
Ok so they're all talking - I have degrees per second info coming in from the Gyro for X Y and Z axis. I'm using the values to alter colour and play sound files :)
Is there a way that I can get a single "impact sense" from the L3GD20H in addition to the XY and Z stuff - maybe from the "int1" pin
Or is there a neat bit of code that can extrapolate and impact sense from the XY and Z info I already have?
Cheers
Ok so they're all talking - I have degrees per second info coming in from the Gyro for X Y and Z axis. I'm using the values to alter colour and play sound files :)
Is there a way that I can get a single "impact sense" from the L3GD20H in addition to the XY and Z stuff - maybe from the "int1" pin
Or is there a neat bit of code that can extrapolate and impact sense from the XY and Z info I already have?
Cheers
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Flora - L3GD20h - Sound Board - can I hook em up....
The L3GD20 is a gyro sensor, so it detects twisting motions better than straight-line events, but try squaring the X, Y, and Z values, adding them together, and finding the square root of the sum.
That will give you the magnitude of the overall input, no matter which way it's pointing. Subtract each value from the one before it and you'll have a value that represents the change between readings. Sudden changes will produce larger spikes in the value.
That will give you the magnitude of the overall input, no matter which way it's pointing. Subtract each value from the one before it and you'll have a value that represents the change between readings. Sudden changes will produce larger spikes in the value.
- evansson
- Posts: 7
- Joined: Mon Mar 02, 2015 5:48 am
Re: Flora - L3GD20h - Sound Board - can I hook em up....
Thanks Mike
I have taken your advice and that all works great. Couple more questions!
I currently have a Flora, monitoring an accelerometer (over 4 pins), also running LED strip (over 3 pins), and sending analogue OUT to a sound board (D9, D10 and D11) left on my flora for triggering sounds.
Flora is too wide, and I want more analogue OUT pins to trigger more sounds.
Is there a smaller board (width-ways: less than 31mm) that will give me equal or better performance than the Flora, and give me some more analogue OUT pins to play with. It's also good to be able to monitor serial over USB. I think I need to stay at 3.7V too. What are my options?
Thanks as ever for your support :)
Steve
I have taken your advice and that all works great. Couple more questions!
I currently have a Flora, monitoring an accelerometer (over 4 pins), also running LED strip (over 3 pins), and sending analogue OUT to a sound board (D9, D10 and D11) left on my flora for triggering sounds.
Flora is too wide, and I want more analogue OUT pins to trigger more sounds.
Is there a smaller board (width-ways: less than 31mm) that will give me equal or better performance than the Flora, and give me some more analogue OUT pins to play with. It's also good to be able to monitor serial over USB. I think I need to stay at 3.7V too. What are my options?
Thanks as ever for your support :)
Steve
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Flora - L3GD20h - Sound Board - can I hook em up....
The Arduino Micro uses an ATmega32u4 (the same chip as the Flora) and offers more pins:
https://www.adafruit.com/products/1086
https://www.adafruit.com/products/1315
https://www.adafruit.com/products/1086
https://www.adafruit.com/products/1315
- evansson
- Posts: 7
- Joined: Mon Mar 02, 2015 5:48 am
Re: Flora - L3GD20h - Sound Board - can I hook em up....
Hi mike
Cheers I've ordered one.
The input from my accelerometer is super responsive for triggering sounds, but seems to slow to a crawl when I'm running a colour wipe loop on my pixel strip at the same time. Is this just terrible programming by me or is the Flora not able to cope with both processes?
Cheers
Steve
Cheers I've ordered one.
The input from my accelerometer is super responsive for triggering sounds, but seems to slow to a crawl when I'm running a colour wipe loop on my pixel strip at the same time. Is this just terrible programming by me or is the Flora not able to cope with both processes?
Cheers
Steve
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Flora - L3GD20h - Sound Board - can I hook em up....
The NeoPixel code is extremely time-critical, so you probably need to interleave that with the code that talks to the sensor.
Your pixel animation will probably have a delay between updates, so try moving the sensor code into that.
Your pixel animation will probably have a delay between updates, so try moving the sensor code into that.
- evansson
- Posts: 7
- Joined: Mon Mar 02, 2015 5:48 am
Re: Flora - L3GD20h - Sound Board - can I hook em up....
Hi Mike
Thanks for the advice - project now working well on a Micro - led and gyro sensor code interleaved and running fast :)
I have adafruit sound boards running in my project - is the a way I can have "sound a" interrupt "sound b" even though sound b hasn't finished playing?
Or do I have to "turn off" sound b and then trigger sound a?
I'm using WAVs but I'd love to make the gaps smaller if poss.
Any way of shortening the detection time?
Cheers
Thanks for the advice - project now working well on a Micro - led and gyro sensor code interleaved and running fast :)
I have adafruit sound boards running in my project - is the a way I can have "sound a" interrupt "sound b" even though sound b hasn't finished playing?
Or do I have to "turn off" sound b and then trigger sound a?
I'm using WAVs but I'd love to make the gaps smaller if poss.
Any way of shortening the detection time?
Cheers
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Flora - L3GD20h - Sound Board - can I hook em up....
The standard trigger doesn't scan the inputs until after the whole sound has played.
The hold-loop trigger will continue to play a sound file as long as the input is held low, but will stop as soon as the input goes high. That, along with some timing control, will probably be your best bet.
The hold-loop trigger will continue to play a sound file as long as the input is held low, but will stop as soon as the input goes high. That, along with some timing control, will probably be your best bet.
Please be positive and constructive with your questions and comments.