Stepper - Display problem
-
- Posts: 21
- Joined: Fri Feb 25, 2022 12:34 pm
Stepper - Display problem
I have built this beauty, but there is a problem. It works just fine, but only the first time I start the instrument. When I turn it off, and try to turn it on again, nothing happens. I supose it is because of some interference between LED displays and stepper motor, because if i try to test each part seperately, everything is ok, I can turn them on and off as many times I want. Displays I'm using are TM1637, stepper 28BYJ-48 with UL2003 driver board. Have also attached external power to Arduino 12V, it helped to remove LED display blinking, while stepper motor is working. So...any ideas?
Thanks,
Janis
Here is the code, I have written.
Re: Stepper - Display problem
Hi, not enough information. Please include schematics and all details of how you calibrate at switch on. Also include the power supply rails and source.
thanks
Joe
thanks
Joe
Joe. CISSP, MSc.
-
- Posts: 21
- Joined: Fri Feb 25, 2022 12:34 pm
Re: Stepper - Display problem
...well, the power to Led displays and stepper motor control board comes straight from Arduino mega board, they are connected in parallel to +5V and GND pin.
Calibration is done with optical sensor, here is the code:
But as I said before, the motor and calibration, when done seperately from LED displays, is working ok. And displays, without motor also works ok. So, I think, the problem is when they come together. On first startup everything works just normal, but after I turn it of an try to turn again, arduino or air manager seems to freeze, until I restart Air Manager, or replug Arduino USB cable.
Calibration is done with optical sensor, here is the code:
Code: Select all
local calibrated = false
NEEDLE = hw_stepper_motor_add("CHRONO", "4WIRE_4STEP", 2048, 30)
hw_stepper_motor_position(NEEDLE, nil, "ENDLESS_CLOCKWISE")
function hall_sensor(position)
if position == 0 and not calibrated then
hw_stepper_motor_calibrate(NEEDLE, 0.0)
hw_stepper_motor_position(NEEDLE, 0.0)
calibrated = true
end
end
timer_start(10000, function ()
function chronometer(data)
if calibrated then -- Optional extra check, you can leave this one out if 10 seconds is always enough
hw_stepper_motor_position(NEEDLE, 1/60 * data)
end
end
xpl_dataref_subscribe("laminar/B738/clock/captain/chrono_seconds_needle", "FLOAT", chronometer)
end)
hw_switch_add("SENSOR ", 1, hall_sensor)
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: Stepper - Display problem
Very nice design in any caseJanisZvirgzdins wrote: ↑Thu Mar 30, 2023 7:49 am chrono.jpg
Hello,
I have built this beauty, but there is a problem. It works just fine, but only the first time I start the instrument. When I turn it off, and try to turn it on again, nothing happens. I supose it is because of some interference between LED displays and stepper motor, because if i try to test each part seperately, everything is ok, I can turn them on and off as many times I want. Displays I'm using are TM1637, stepper 28BYJ-48 with UL2003 driver board. Have also attached external power to Arduino 12V, it helped to remove LED display blinking, while stepper motor is working. So...any ideas?
Thanks,
Janis
Here is the code, I have written.
AA Chrono APVIENOJUMS - .siff
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Stepper - Display problem
Hi,JanisZvirgzdins wrote: ↑Thu Mar 30, 2023 9:07 am ...well, the power to Led displays and stepper motor control board comes straight from Arduino mega board, they are connected in parallel to +5V and GND pin.
Here is your problem. The arduino cannot handle a display and servo,
Connect a external 5v power supply to the servo and display. Only the Gnd needs to be common .
.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
-
- Posts: 21
- Joined: Fri Feb 25, 2022 12:34 pm
Re: Stepper - Display problem
...well, i conected seperated power suply for displays and one more for stepper motor, connected to common ground, but the problem remains the same. It works for the first time, but after turning instrument off, it does not turn on again
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: Stepper - Display problem
Indeed both power supply ground should be common to the Arduino board GND !?JanisZvirgzdins wrote: ↑Thu Mar 30, 2023 11:04 am ...well, i conected seperated power suply for displays and one more for stepper motor, connected to common ground, but the problem remains the same. It works for the first time, but after turning instrument off, it does not turn on again
-
- Posts: 21
- Joined: Fri Feb 25, 2022 12:34 pm
Re: Stepper - Display problem
Yes, to the ground of Arduino, and both displays and motor driver board.
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Stepper - Display problem
Hi,
What does not turn on again?
The displays or the servo of both.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
-
- Posts: 21
- Joined: Fri Feb 25, 2022 12:34 pm
Re: Stepper - Display problem
Both do not turn on again, and also buttons does not work.