I2CN17

Introduction

This is an I2C to stepper motor controller featuring standard modules, current limiting and micro stepping. Ideal because only an I2C interface is required. Suitable for art installation, animatronics, mechanical furniture and the like.

It can be supplied as a kit or ready built.

Kit

This is the complete kit of parts that can be soldered into place. Important the capacitors need to go the correct way round with the long lead going to the left hand side. Connectors may be supplied with different colours.

This is the assembled device without the motor controllers in place.

Resources

Arduino Library

*** Pull up resistors will be required if used with the UNO or Nano ***

Please not that this is intended as a staring point, it is not intended as a full blown library. I has also only been tested on the UNO

(see example for constructor, default i2c address is 0x29)

Applies to all Motors

        void en(uint8_t on); // global enable 1=enable 0 = disable
        uint8_t status(void); // returns status
        void mreset(void); // resets motor
        void all(uint8_t xH,uint8_t xL,uint8_t yH,uint8_t yL,uint8_t zH,uint8_t zL); // sets all at once

Applies to specific motor = 10 = X, 20 = Y, 30 = X

        void ru(uint8_t motor, uint8_t value); // set ramp up
        void rd(uint8_t motor, uint8_t value); // set ramp down
        void sps(uint8_t motor, uint16_t value); // set steps per second
        void steps(uint8_t motor, uint16_t value); // set number of steps to step
        void dir(uint8_t motor, uint8_t value); // set direction
        void steps(uint8_t motor, uint16_t steps, uint8_t direction); // sets steps and direction in one command
        uint16_t togo(uint8_t motor); // returns number of steps to go

System

        void EEreset(); // reset default eeprom values
        void change_i2c(uint8_t new_address); // changes i2c address
        void EEwrite(uint8_t adr, uint8_t value); // write to eeprom
        uint8_t EEread(uint8_t adr); // read from eeprom
        uint16_t ID(); // return device id
        void Version(uint8_t *b); // return firmware version 3 bytes
        void reset(void); // global reset

RPi and ESP8266 Libraries

Both of these are very similar because they use either Python of MicroPython. Currently Python version 3 is used.

See the individual classes for the names of the functions, there are not that many and reasonably straightforward.

Voltages

The device can work on 3.3 or 5V logic and so is compatible with both voltages. However because it is I2C providing the pull up resistors go to (match) the host voltage then it does not matter which voltage is used.

History

Released 21 March 2018