Stepper - Display problem

Questions about deployment and use of Air Manager Instruments

Moderators: russ, Ralph

Message
Author
JanisZvirgzdins
Posts: 21
Joined: Fri Feb 25, 2022 12:34 pm

Stepper - Display problem

#1 Post by JanisZvirgzdins »

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
(9.37 KiB) Downloaded 39 times

User avatar
jph
Posts: 2856
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Stepper - Display problem

#2 Post by jph »

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
Joe. CISSP, MSc.

JanisZvirgzdins
Posts: 21
Joined: Fri Feb 25, 2022 12:34 pm

Re: Stepper - Display problem

#3 Post by JanisZvirgzdins »

...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:

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)
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.

SimPassion
Posts: 5339
Joined: Thu Jul 27, 2017 12:22 am

Re: Stepper - Display problem

#4 Post by SimPassion »

JanisZvirgzdins 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
Very nice design in any case 👍

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Stepper - Display problem

#5 Post by Keith Baxter »

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.
Hi,

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 

JanisZvirgzdins
Posts: 21
Joined: Fri Feb 25, 2022 12:34 pm

Re: Stepper - Display problem

#6 Post by JanisZvirgzdins »

...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 :cry: :cry: :cry:

SimPassion
Posts: 5339
Joined: Thu Jul 27, 2017 12:22 am

Re: Stepper - Display problem

#7 Post by SimPassion »

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 :cry: :cry: :cry:
Indeed both power supply ground should be common to the Arduino board GND !?

JanisZvirgzdins
Posts: 21
Joined: Fri Feb 25, 2022 12:34 pm

Re: Stepper - Display problem

#8 Post by JanisZvirgzdins »

Yes, to the ground of Arduino, and both displays and motor driver board.

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Stepper - Display problem

#9 Post by Keith Baxter »

JanisZvirgzdins wrote: Thu Mar 30, 2023 11:04 am it does not turn on again :cry: :cry: :cry:
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 

JanisZvirgzdins
Posts: 21
Joined: Fri Feb 25, 2022 12:34 pm

Re: Stepper - Display problem

#10 Post by JanisZvirgzdins »

Both do not turn on again, and also buttons does not work.

Post Reply