Controlling a 5V PWM controlled fan causing errors in my HC 04 ultrasonic sensor
First time posting to this forum for help.
I am building a project to control the height of a ping pong ball in a tube.
Ive designed this to be powered solely buy an Arduino Uno (I hope)
I have a 5v (180ma) PWM controlled fan
And a HC 04 ultrasonic sensor 5v (15ma)
My connections are as follows
Power is from the 5v & Gnd on the Uno power rail
Control is from the Digital rail PWM pin 3
Sensor HC 04
Power is from the other 5v & Gnd on the Uno power rail
Control from pins 7 & 8 for echo and trigger.
Control is through LinX (Makerhub add-on) to Labview
At this point my fan is running and lifting the ball and my sensor is reading back. All good
The issue I am noticing is that the sensor reading is becoming erratic and unsettled when the fan is running from 30% to full power on and this is going to have an effect on my control system.
My first thought is that the Arduino can't provide enough power. but it should be capable of 500 ma power and 40 ma per pin which I am well within.
Am I right in saying the PWM pin to control the fan uses almost no current and is only a voltage control between 0-5 Volts and that the power / current to run the fan is from the power rail.
Or is it the case I have this wrong and require a mosfet to control the fan. but if so I would nt have gotten the fan to run so far.
Any help is much appreciated