Hello,
I am using an Arduino Uno to drive an actuator at a set tempo and measure sensors at the same time. I am having an issue with my analogRead values jumping by 5-10 (out of 1023) when the digital pin is written to HIGH. I have measured my sensor output with a multimeter and have not seen any jump, so it leads me to believe it is something within the board/ code that I am missing. Thanks!
If the sensor is ratiometric, then it is easier to solve. If the sensor output is a voltage, then you need another sensor or solve the power problem.
In your sketch, you use two millis-timers with the same 'msLast'. That is okay, nothing wrong with that. It is also possible to use a single millis-timer and change the interval: millis_different_on_and_off_times.ino.
You can investigate these situations by disconnecting things that require current, disconnect motors and strong leds and so on. Let the sketch run, and you will see that the digital pin does not change the analog input. Then you know that power-hungry devices are the problem.
tlestak:
Hello,
I am using an Arduino Uno to drive an actuator at a set tempo and measure sensors at the same time. I am having an issue with my analogRead values jumping by 5-10 (out of 1023) when the digital pin is written to HIGH. I have measured my sensor output with a multimeter and have not seen any jump, so it leads me to believe it is something within the board/ code that I am missing. Thanks!
What's happening is that either the Vcc is dropping when the actuator runs, causing ADC values to read high
as they are ratiometric to Vcc.
Or you have a ground loop or Vcc loop that's injecting IR voltages into your sensor circuit. You shouldn't be
sharing any wiring that carries high currents with any analog sensor wiring, as the currents generate
IR voltages across the wires (a wire is just a resistor), alterning the perceived sensor voltages.
Koepel:
If the sensor is ratiometric, then it is easier to solve. If the sensor output is a voltage, then you need another sensor or solve the power problem.
or: use the internal 1.1V reference, which is independent from Vcc.