I'm working to make a simple pedometer with Arduino, and after managing to find an algorithm that correctly finds the steps, I added a bluetooth extension (the overly popular and cheap JY-MCU) to check the steps via bluetooth.
I am facing a strange issue, though: when the bluetooth device is powered and waiting for a connection (red led blinking) the analog read function that reads data from the accelerometer goes crazy (thus the pedometer finds a step each second or so). When the bluetooth is powered down or connected to a device such as a mobile phone this doesn't happen.
Did anyone have this problem before? What could be the issue? My setup is easy, you can see it on the image.
I had other sensors as well but since the problem stays even when there are only those two connected I posted the bare minimum setup. At first I thought I could use some kind of pull-ups to stabilise the signal, but I really have no idea on where to tie them and if they can really be helpful at all...
Any help is appreciated.
-
Try placing them further apart. Also use two separate wires to power the two modules (which you are probably already doing). If all that fails, try powering the ADXL from 3.3v. If this fixes thing, it means there is some coupling issue.Gerben– Gerben2015年10月05日 14:23:55 +00:00Commented Oct 5, 2015 at 14:23
-
1Yes, the common red line of the drawing is in reality the long "+" line of the breadboard, and two different wires go to BT and ADXL. Powering either of the two with the 3.3v out doesn't help either (originally my idea was of powering the BT with one of the out pins because that way I could control when powering on and off the BT, but for the sake of resolving this issue I momentarily switched to the common rail of power). The only "fix" is when I power the BT with an external battery (which, as you say, it means there are coupling issues)...Luca– Luca2015年10月05日 14:28:34 +00:00Commented Oct 5, 2015 at 14:28
-
Try adding a small value cap between AREF and ground. Who knows.Gerben– Gerben2015年10月05日 14:37:13 +00:00Commented Oct 5, 2015 at 14:37
-
Please add an analysis of the power budget. How much current can the 3.3V pin on the Uno supply? How much does the BT require (on peak)? Etc. You need to always do the numbers; hardware and software.Mikael Patel– Mikael Patel2016年02月02日 06:45:40 +00:00Commented Feb 2, 2016 at 6:45
1 Answer 1
You can try decoupling the power for the bluetooth:
The resistor value should be tiny - 10Ω is a good value to use - don't go much higher than that. The capacitor should be nice and big - I have shown 100μF, but bigger is better - whatever you have that's nice and big. (Make sure you wire it the right way round - check which pin is marked as -) You might also want to add a small capacitor (say 100nF) in parallel with the large one.
-
It seems it is not working. At first I thought it was, but I had some code wrong. I'll try again and keep you posted.Luca– Luca2015年10月05日 07:58:22 +00:00Commented Oct 5, 2015 at 7:58
-
Decoupling should be the right solution because when I connect the bluetooth to an external battery it gives me no problem. I just have to figure out why I can't decouple it correctly!Luca– Luca2015年10月05日 09:15:10 +00:00Commented Oct 5, 2015 at 9:15
-
What size components are you using? I only guessed the values in the drawing, it may take some adjustment. Try smaller resistor, or replace the resistor with an inductor.Majenko– Majenko2015年10月05日 10:16:13 +00:00Commented Oct 5, 2015 at 10:16
-
I tried capacitors up to 1000micro, and the resistor as suggested 10 ohm. I'll see if at home I have some smaller resistors or an inductorLuca– Luca2015年10月05日 10:54:25 +00:00Commented Oct 5, 2015 at 10:54
-
Just one question: I managed to find a 2200µF capacitor and tried that as well. But I noticed that it's a 6.3V capacitor. Could the voltage difference be an issue and the reason why decoupling does not work? Do I have to find a 5V one maybe?Luca– Luca2015年10月09日 10:02:40 +00:00Commented Oct 9, 2015 at 10:02