Go Down

Topic: Control treadmill motor board with arduino  (Read 900 times) previous topic - next topic

kulboza

hi guys
i want to control treadmill motor board with arduino can any one help my with the code i try this code :

int PWM_OUT = 9;
float duty = 0.0;
int onTime;
void setup()
{
  pinMode(PWM_OUT, OUTPUT);
  pinMode(9, OUTPUT);
}
 
void loop()
{
  onTime = floor(duty*100);
  digitalWrite(PWM_OUT, HIGH);
  digitalWrite(9, HIGH);
  delay(onTime);
  digitalWrite(PWM_OUT,LOW);
  digitalWrite(9, LOW);
  delay(100-onTime);
}


but didn't work i do not know what is wrong i want to control the delay time and the speed and the duty the treadmill control board model alt 6891 and the chip that control the board tl494c

pert

onTime = floor(duty*100);
This will always be 0. So your code is going to set PWM_OUT and 9 HIGH for only a tiny fraction of time before setting them LOW again.

It also doesn't make sense that you have pinMode and digitalWrite statements controlling both PWM_OUT and pin 9, since PWM_OUT is defined as 9.

You need to provide a detail explanation of what you're trying to accomplish.

kulboza

This will always be 0. So your code is going to set PWM_OUT and 9 HIGH for only a tiny fraction of time before setting them LOW again.

It also doesn't make sense that you have pinMode and digitalWrite statements controlling both PWM_OUT and pin 9, since PWM_OUT is defined as 9.

You need to provide a detail explanation of what you're trying to accomplish.
hi
all what i need to do in to make the treadmill board send electricity to the motor and control the speed

kulboza


darkenney

Is your board connected to the treadmill motor? It's not in the picture. On the far right of your picture, there's  M- and an M+ pins. Those go to the treadmill motor. You show some code, but what is your arduino connected to?

Need to take a few steps back here.  They way it works is there's some multipin cable(s) that connect(s) the lower board to a top board where the user controls are. Without the top board, you have to figure out what to have arduino feed into the control pins on the lower board to make the treadmill go.

Also, you don't give the lower board pwm directly. You feed it a signal into the correct pins of the lower board (lower board pin out please) and the lower board produces the pwm for the treadmill motor.

Aside from a few lines of code, what connections have you made?

kulboza

#5
Jan 16, 2019, 04:03 pm Last Edit: Jan 16, 2019, 04:09 pm by kulboza
first i want to thank you very much for your replay guys
this board connected to treadmill motor throw pins M+ and M- and connected throw pins AC1 & AC2 to 220v ac  and connected throw pins VCC,NC,GND,TXD,RXD,S/W to the top user board i want to remove user board with arduino uno but the problem i don't know which pin i connect of this pins "VCC,NC,GND,TXD,RXD,S/W" to connect arduino and i want to type an arduino code to control the power board to make it send power to the motor and i try to test this pins during it working vcc,gnd it gives me 12v dc and try to test txd,gnd it gives me 4.5v to 4,8v and try to test rxd,gnd it gives me 4.5v to 4.8v & 93% duty cycle and 2hz and raises up to 30hz when i raise up the speed what i understand from all this that pin vcc powers the user board and gnd is the ground and txd the signal from power board to userboard and rxd the signal from userboard to powerboard  and i donot know s/w means and nc not connected to any thing

wolframore

RX and Tx sounds like serial communication with the upper board.  I'm sure you're you've tried doing an online search, this board has no documentation online... So we are all flying blind.

Looking at your picture. There appears to be a crystal, so my guess is there's a controller built into this thing.



As far as how to connect and what to send in terms of Arduino signals, you're going to have to play around and do some detective work.  You can't just expect people to guess and know what a specific board does.

There are some treadmill motor-controller projects and they may have more clues on the steps you need to take to figure this out.

At this point we can only guess and do not want to lead you astray and have to smoke something.

If you have an oscilloscope I would check the output of Tx and Rx to see if you see pulses.  DC reading will not tell you much... just that there's something there.
Bad Boys Rate Our Young Girls But Violet Goes willingly - Get Some Now :) - ELI the ICE man

darkenney

#7
Jan 16, 2019, 06:01 pm Last Edit: Jan 16, 2019, 06:07 pm by darkenney
kulboza, I'm struggling to understand fully what you've written above.

However, this is not a simple or straight forward effort, and will be a long road. A quick solution is not going to happen.

1) M+ and M- connect the lower board to the DC motor that drives the treadmill belt.

2) AC1 and AC2 go from the lower board to a master switch on the treadmill, to a fuse, and then to the power cord and wall outlet. Most lower boards have an led that lights when it's receiving power from the wall.


3) S/W is the kill switch - that's the magnet device on the front of the treadmill that the runner attaches to their clothing. When you make a connection between S/W and VCC (usually by connecting the magnet on the front of the treadmill), you will hear a Relay on the lower board click. You can make this S/W VCC connection by connecting the magnet, jumping those two wires together directly, or having VCC and S/W going through Arduino. It doesn't matter at this very early stage of the process.

4) Now we to try to figure out what exactly to send down which wire to the lower board to get the motor to go. Figure that out first and then after that get the Arduino to do it.

From what I think is written above, a pwm signal between ground and rxd operates the motor. You indicate a 93% duty cycle --- was the treadmill near full speed when doing that??!!!  When the treadmill is working and you change the speed does the duty cycle on that rxd change?




darkenney

Looking at the picture of the board, I can see M+, M-, and AC1 and AC2. In the lower left of the pic are three blade connectors that control the incline of the treadmill. I'd guess that in your setup they wind their way up to the top board also. Getting Arduino to send pulses through there will control the up and down incline of the treadmill. The connector on the bottom right of the board is the 6 pin with S/W, VCC, NC, RX, TX, and Ground.

Now my question --  on the right side edge of the board, is a 4-pin, a 2-pin, and a 3-pin. Those will also go to the top board. Do you know what they control?

As was mentioned, we're doing an awful lot of guessing here.

wolframore

Pin connectors on the right: again guessing - but common on other similar controllers:

speed sensor
encoder for up and down
Bad Boys Rate Our Young Girls But Violet Goes willingly - Get Some Now :) - ELI the ICE man

darkenney

Again, lots of guessing, but I'll share how my treadmill behaves as it might provide insight to how yours behaves.

On my treadmill, I connect vcc and s/w for power. Then touch together and release ground and the speedup wire over and over to increase speed. Touch together and release ground and slowdown wire over and over to decrease speed.

On my treadmill the user control wires *do not* send a pwm signal to the lower board. It's just that momentary connect of speedup to ground and slowdown to ground that controls speed. The lower board receives that signal and figures out the pwm to send on to the motor.

(You had mentioned that your board has a pwm chip on it, so I would be surprised if your upper board is actually sending a pwm signal to the lower board, and instead behaves more like mine and just sending an increase decrease signal to the lower board and the lower board determines what to do.)

The belt has a reed sensor with two or three wires that connects to the lower board and then, probably as was mentioned, through one of those connectors on the right, to the upper board. Reading the HIGHs and LOWs that come through that from the reed sensor enables you to calculate mph. You could take those reed switch wires and go into the arduino to start to figure mph.

kulboza

#11
Jan 16, 2019, 09:08 pm Last Edit: Jan 16, 2019, 09:15 pm by kulboza
Now my question --  on the right side edge of the board, is a 4-pin, a 2-pin, and a 3-pin. Those will also go to the top board. Do you know what they control?

As was mentioned, we're doing an awful lot of guessing here.
first i want to thank all the people how trying to help me
and about 3-pins is for incline and 2-pins connected to speed sensor and 4-pin not connected to any thing and about rxd signal i measure it with gnd with multi meter with frequency option i found when the treadmill is in low speed the frequency 5Hz and the duty cycle 99% to 100% and when i raise the speed the frequency goes up and the duty cycle is staying at 99% to 100% and i try this arduino code with pin rxd and gnd and nothing happened

int i = 13;   

void setup() {
pinMode(i,OUTPUT);
}

void loop() {
digitalWrite(i,HIGH);
delay(200);
digitalWrite(i,LOW);
delay(0);

}

i connect pin 13 to rxd and pin gnd to gnd in arduino

darkenney

3-pins is for incline and 2-pins connected to speed sensor and 4-pin not connected to any thing
Ok, good to know. That means speed control is going through the 6 pin connector. Now the 6 pin has VCC (power), S/W (kill switch), and NC (not connected). That hopefully means speed is controlled through some combination of RX, TX, and Ground. Try to confirm this. Without Arduino, on the 6 pin going to lower board, jump together VCC and S/W. Then jump together RX, TX, and GND of the lower 6 pin connector and the upper 6 pin connector. See my pic.



If all goes well with that setup, you should still be able to run the treadmill. If you're able to speed up and slow down the treadmill with that combination, try it with just RX and Ground, or just TX and Ground. I'm now thinking that you'll need to use all three to control the speed. 

kulboza

Ok, good to know. That means speed control is going through the 6 pin connector. Now the 6 pin has VCC (power), S/W (kill switch), and NC (not connected). That hopefully means speed is controlled through some combination of RX, TX, and Ground. Try to confirm this. Without Arduino, on the 6 pin going to lower board, jump together VCC and S/W. Then jump together RX, TX, and GND of the lower 6 pin connector and the upper 6 pin connector. See my pic.



If all goes well with that setup, you should still be able to run the treadmill. If you're able to speed up and slow down the treadmill with that combination, try it with just RX and Ground, or just TX and Ground. I'm now thinking that you'll need to use all three to control the speed. 
i try the to do what you draw in the image i hear the relay work but an error appear in the upper board and i try to do this



the upper board works but the motor did not spin


about rxd signal i measure it with gnd with multi meter with frequency option i found when the treadmill is in low speed the frequency 5Hz and the duty cycle 99% to 100% and when i raise the speed the frequency goes up and the duty cycle is staying at 99% to 100% and i try this arduino code with pin rxd and gnd and nothing happened
when i said than i connect rxd and gnd i was wrong i mean s/w and gnd

darkenney

Yeah, it does make sense that it's not working. In the setup I had, upper board isn't getting power. In the setup you have the s/w kill switch isn't connected.   The dmm readings youre getting across rx tx are confusing. If we assume that speed does go through rx and tx. You could run those from the top board to arduino. And then continue them from arduino to lower board and try to use arduino to get a better sense of what the top board is sending to the lower board to change speed. What treadmill is it?

Go Up