Page 1 of 1

SX1509 Expander and motor pwm

Posted: Mon Dec 11, 2017 1:37 pm
by shmulik
Hello
I recently bought SX1509 I/O Expander and i try to control some DC motors with PWM signal ( 8 motors at the same time).
I noticed that when i give a '0' pwm value:
Code: Select all
io.analogWrite(Motor_pwm_pin, 0);
the motor turns in its heighst speed.

and if i do:
Code: Select all
io.analogWrite(Motor_pwm_pin, 255);
the motor stops completly.

This is reversed to what i know, and what i usually do by hooking up a Motor Driver directly to an arduino.
Is it because of "Sinking Current"?
If it does can you please explain more about it ?

Thank you for the help !

Re: SX1509 Expander and motor pwm

Posted: Tue Dec 12, 2017 4:49 am
by paulvha
I expect it does have to do with Source or Sinking. In Source configuration, the SX1509 provides the +voltage to the LED/motor with the other side of the LED/motor connected to ground. in sinking mode, it is working the opposite. The current is flowing from the +voltage, through the LED/motor and the SX1509 pulling to ground. Thus in sinking mode, writing a zero, means that the SX1509 is 100% of the duty cycle connected to ground, The LED/motor at full speed. Writing 255 the SX1509 is 100% of the duty cycle providing +V, thus turning off the LED/motor. In sink configuration it can handle 15mA, where in source the max is 8mA (depending on the voltage) That is less than an Arduino which can handle up to 40mA. So be careful not to overload. The data-sheet states that ports can be put in parallel to increase the current in sink, but then you have control multiple ports at once (never liked that kind of tricks)

Re: SX1509 Expander and motor pwm

Posted: Tue Dec 12, 2017 11:37 pm
by shmulik
Thank you for the answer.
I didnt understand why there should be an overload if i run 8 motors at the same time ?
They are all connected to 8 Motor Drivers (each motor driver to its DC motor) .
So the power source and current for running the motors are coming a different power source and not from the arduino itself.
am i right ?

Re: SX1509 Expander and motor pwm

Posted: Wed Dec 13, 2017 1:47 am
by paulvha
2 aspects :

I do not know how much mA your motors take. The limit of 15mA is per channel, not in total. It was just a warning as you mentioned you had connected before directly to an Arduino.

The power is the same power source the only difference is the direction. The SX1509 can handle more current when the current is flowing IN: when pulling to GND, rather than providing current OUT with a positive voltage. I suspect this is because of the internal design: maybe a better/stronger GND track internal and thus it can handle more or the current OUT is provided through an internal pull-up resistor.