SX1509 Expander and motor pwm

Have questions about a SparkFun product or board? This is the place to be.

Moderators: phalanx, TS-Tim

Post Reply
shmulik
Posts: 5
Joined: Sat Sep 26, 2015 3:46 pm

SX1509 Expander and motor pwm

Post by shmulik » Mon Dec 11, 2017 1:37 pm

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 !

paulvha
Posts: 198
Joined: Sat Nov 11, 2017 2:39 am

Re: SX1509 Expander and motor pwm

Post by paulvha » Tue Dec 12, 2017 4:49 am

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)

shmulik
Posts: 5
Joined: Sat Sep 26, 2015 3:46 pm

Re: SX1509 Expander and motor pwm

Post by shmulik » Tue Dec 12, 2017 11:37 pm

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 ?

paulvha
Posts: 198
Joined: Sat Nov 11, 2017 2:39 am

Re: SX1509 Expander and motor pwm

Post by paulvha » Wed Dec 13, 2017 1:47 am

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.

Post Reply