Im using a Bar02 to collect depth data for a vertical profiling float (MATE competition), and im having lots of trouble getting the sensor to read properly on the actual device, and I believe it is tied to interference/jumps tied to the servo im using for the device.
Has anyone else had similar problems? If so, how have you dealt with it? I’ve been running into this for almost 2wk now, and it’s crunch time now.
Have you increased the length of the wires going to the sensor? That can cause issues, but letting the frequency of you i2c bus may help alleviate them!
If the problem occurs when your servo is under load, it may be do to voltage drop- you could add a large capacitor to help maintain the voltage?
Just some ideas, if they don’t help please share more details- pictures, code, etc.
I have increased the length of the wires, but it is marginal. I put about 3in of solid core wire on the end of the sensor output to make my life easier in dealing with screw terminals.
How would you recommend going about the capacitor approach? Im seeing every pin staying high at 3.3v the whole time except for the SDA, which drops around the time the servo kicks. Should the capacitor go at the SDA or 3.3V pin? And how big a capacitor?
I’d suspect it’s actually that transition to solid core wire that could be causing issues? Any extension of length is questionable, and a change of wire type can cause issues with the high frequency signals- black magic!
If the issue is voltage drop,a capacitor between 3.3v and ground will help.
If you have a oscilloscope, checking the clock and data line to make sure you have nice clean square shaped signals is the best way to “look under the hood” at signal quality…
Unfortunately, I do not have access to an oscilloscope, all my work is currently through my school’s robotics program, so naturally the funding isn’t flowing enough to have an oscilloscope.
Also as a result, I cant work much now. I’ve been able to get good data isolated of the servo, so im inclined to say it’s tied to that. Where should a capacitor be placed for this? In line with the positive lead of the sensor, or in parallel of the sensor? I’ve taken a voltmeter to the pins, and the voltages are staying pretty constant through servo pull-up.
Yes that’s correct. Most capacitors have polarity, so make sure that the “leg” of the capacitor marked for ground is attached to the ground, and the opposite to your supply voltage.
The bigger the better¡ 10uf or more skills help - I’m no electrical engineer but LLM AI may help you specify a size if you give it the servo voltage and power it consumes under load.