I tried to read the value of my potentio adc through the serial number, but the number changes, for example, if I set the output value to 200, the value in the serial number display is in the range of 200-201-202, is there a way to make it stable and not change?
this is my program
#include <Stepper.h> #define STEPS 200
Stepper stepper(STEPS, 2, 3); #define motorInterfaceType 1
int adc = A0;
int dirPin = 2;
int stepPin = 3;
int buzz = 4;
void setup() {
Serial.begin(9600);
pinMode (dirPin,OUTPUT);
pinMode (buzz,OUTPUT);
}
Try putting a 0.1uF ceramic cap from the wiper of the pot to ground to filter noise. It is normal for there to be a 1 or 2 bit jitter in the ADC output. You may not be able to make it dead stable.
Read the forum guidelines to see how to properly post code. Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
No.
You can add a capacitor at the input of the A/D pin but this will slow things down but not stop them from changing.
Every analog signal has electrical "noise" on it. The trace depicts noise on a signal. When the A/D converter "reads" the signal some of that noise gets factored in. It can be reduced but cannot be eliminated.
This is why the world has gone to mostly digitized signals.
If you absolutely need a stable signal, look into encoders.
Hi,
How are you powering the stepper.
Can you please post a link to data/specs of the stepper and the driver?
Can you please post a copy of your circuit diagram?
i use nema 17. 1.8 degree step, 1.2 Amps, 200 steps per revolution
im using 12 volt dc to run the motor and the driver
you can fiind it on google how to wire bipolar stepper motor with A4988 driver