Ultrasonic Sensor strange output

henriksod

Member
My ultrasonic sensor have started behaving strange. It frequently outputs very low numbers at long distances and it usually comes in 8's or 7's:

Terminal 9600
Range = 185
Range = 188
Range = 192
Range = 189
Range = 8
Range = 189
Range = 8
Range = 8
Range = 8
Range = 8
Range = 189
Range = 189
Range = 190
Range = 8
Range = 8
Range = 191
Range = 191
I have an i2c MLX90414ESF-AAA device and am using PWMOUT for motor driving. The problem was there before I started using PWM, but with less frequency, it seemed.

range = w1 and B0-B19 is unused so there can't be any interference with variables.

It's strange that it comes in 8's or 7's. I suspect that I'm getting input from something that emits a constant value here...

Any suggestions?
 

BeanieBots

Moderator
US modules need to increase their input stage gain as the distance gets larger.
At longer ranges, they become far more sensitive to noise.
It is very likely that your US module is picking up PWM noise and thinking it's an echo.
Confirm that turning off PWM stops the problem.
If it does, consider using screened cable for the leads (including power) going to the US.
Make sure any motor cables are well clear of any cables going to the US and/or PICAXE.
Make sure there is plenty of suppression on the motor. (100nF across motor terminals at the motor and 100nF between each terminal and the motor case).
 

henriksod

Member
So, this is what I will do:
0J678.300.png

That is a very good point. I have four motors, none of them has suppression capacitors.

I will return with results when I have got my hands on all 12 of these 0.1uF capacitors needed.

Meanwhile, could you explain the scientific aspect behind doing this, since I am still learning about electronics and would like to know what the capacitors do to suppress the noise?
 

BeanieBots

Moderator
Yes, exactly as you have drawn it.
Suppression is a very complex topic but the basics are simple enough.
For a simple brushed motor (which I assume you have), whenever the armature commutator switches from from one coil to the next, a large inductively driven current is switched. When the current is removed from an inductor it tries its hardest to stop the current from changing. It does that by increasing the voltage which keeps increasing until its high enough to arc across the gap. This makes sparks and sparks radiate noise.
By putting a cap across the terminals, a lot of the current change is absorbed by the cap and hence the sparks are much less intense.
Unfortunately, no component is ever perfect and the cap itself with the large voltage changes across it will also radiate.
A large amount of that radiation can be 'disposed of' by sending it down to the motor casing.
The two caps on the case also prevent the case from giving off large amounts of RFI by conducting it down to the power supply.
Using two caps of the same value keeps the current (of the noise) equal in both supply wires and thus helps reduce radiated noise comming from the power cables.
There is loads more you could do but 90% of the time the three caps is enough.
Good luck, hope it goes well.
 

xtech007

Senior Member
this might help!

Hope it helps!
My experience with range finders(HC-SR04) is not Vast, but did ran into same senario once. Did the same wierd reading you are getting at 2 occasions. 1st when it had nothing in front of it and 2nd just random while sweaping left to right using servo, i did use 2 dc motors too.

Fixed (would like to think so) by pulling all unsused inputs,and adc ports high.

Read somewhere it would help!
Since, had no sign of the issue!

Good luck!
 

techElder

Well-known member
Capacitors to the motor frame can be effective if the motor frame is actually at "ground" level. If the motor is mounted in a plastic frame, then those two capacitors are just in series and in parallel with the third capacitor; not all that effective. Be sure that the "noise" you are shunting into the power / drive leads has a low-impedance path to "ground". Once the "noise" event is stored in the capacitors, it has to be discharged somewhere.

View attachment 15837 ... suppression capacitors ... would like to know what the capacitors do to suppress the noise?
 

henriksod

Member
Capacitors to the motor frame can be effective if the motor frame is actually at "ground" level. If the motor is mounted in a plastic frame, then those two capacitors are just in series and in parallel with the third capacitor; not all that effective. Be sure that the "noise" you are shunting into the power / drive leads has a low-impedance path to "ground". Once the "noise" event is stored in the capacitors, it has to be discharged somewhere.

So I should basically just solder wires between the motor cases and the metallic chassi?
 

techElder

Well-known member
Noise suppression is an art. Try something and see if it is better.

I doubt you are generating ultrasonic "noise" with your motors, but the motor brushes create unseen sparks (especially under load) that create RF "noise" that could be affecting your circuits.

Those low numbers, like "8" could be measurements off of side lobes of the ultrasonic transducer. Experiment with a sleeve of damping material wrapped around the transducer.

I've just moved my finger around the edge of the transducer to check for this kind of problem. If you damp the transmitted side lobe, the low reading will change or go away. (It could also be a fault inside the transducer case.)
 
Top