PCF8574 and Stepper addressing

Hello,

For my first project with Arduino (UNO r3), I wanted to use an LCD shield and 2 stepper motors.
LCD as all we know, takes a lot of pins, so if I want to connect yet 2 stepper motor which take 4 pins each, I have to loosen up some pins, so I decided to use I2C and Wire lib.

I know, I may use I2C on my LCD and even there is this cool library to have it out of the box.
But I thought, hey! I am learning! So started to think what I can do to leave my LCD where it is, and connect 2 stepper motors to PCF8574 using I2C.

How to connect - not a problem, how to address?
The real question from you to you guys, is:

  1. Is there any way to define the pins in Stepper constructor that will point to pcf pins?
  2. Do I have to write/change the Stepper library to user I2C addresses?
  3. Am I thinking anything wrong here?

Thanks for the answers!

Hi,
This probably COULD be done, and you are good at thinking 'out of he box'. You would have to modify the Stepper code to set bits through the I2C chip.

But steppers need accurate timing, and the LCD does not. So you may want to just keep the I2C interface for the LCD.

There's lots of other fun stuff to invent!

The main snag is that the I2C bus is slow, so the stepping rate would not be so fast. You need an interface chip as well, that sets the address.

If you want to go down this route then get an SPI port expander chip, that is much faster and only uses three pins.

Hi!

Thank you! After your anwers, I realize that lack of suck ready library for Stepper is not a coincidence (accordingly to lcd i2c, which exists)

terryking228:
There's lots of other fun stuff to invent!

I know, but:

  1. This is my first steps so I didn't want to make it a rocket science
  2. Also I said myself that if I am doing something for the first time, the best will to build something I will use. And what I want is to build a timelapse shooter with possibility of moving the camera during shooting time.

Thank you again!
Filip

What stepper motors are you using?

If they are bipolar motors use a proper stepper motor driver board (the Pololu A4988 is a good example but may or may not suit your motor) and then each motor only needs 2 pins for step and direction. Also the Arduino code to control the motor will be very much simpler.

...R

I realize that lack of suck ready library for Stepper is not a coincidence

I think there are too many library for the Arduino, it stops learning how to code.

I used a 23S17 port expander chip to drive three motors on this project:-
http://www.thebox.myzen.co.uk/Hardware/CNC_Conversion.html
Software downloadable from that page.

It is an SPI port expander and by using a Pololu driver for each motor covered the three motors in just half the pins it gave.

Grumpy_Mike:

I realize that lack of suck ready library for Stepper is not a coincidence

I think there are too many library for the Arduino, it stops learning how to code.

I was not trying to avoid coding - it was only my suspects, that if there is a lib for lcd and not for a stepper, there has to be a real reason for that.

Remember, I am trying to learn, and picking ready-to-use will not help in in that. In this case though, I was afraid, that whole my thinking went wrong with this steppers on PCF.

Grumpy_Mike:
I used a 23S17 port expander chip to drive three motors on this project:-
http://www.thebox.myzen.co.uk/Hardware/CNC_Conversion.html
Software downloadable from that page.

It is an SPI port expander and by using a Pololu driver for each motor covered the three motors in just half the pins it gave.

Thanks - I will take a look for sure! I am using simple 28YBJ-48 as a proof of concept. If I will achieve what i want, Ill try to build it with this motors and evenly snailgears, or if needed, I will replace them with more adequate (then I will sit and count/read what do I need)

F