I2C 8+8 expander with extra features


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2008
    Location
    Italy
    Posts
    825

    Default I2C 8+8 expander with extra features

    This project, based on pic16F876, was born as a simple 8+8 IOs expander because in industrial automation IOs are like bread.

    Recently I have been requested to project a precision positioning machine with 3 axis and a spindle all driven with closed loop ac servo system (SanyoDenki)

    I came to the conclusion that it was the right time to add extra features to the expander, in order to have a multi-purpose device, that I could also use for future applications.

    I am posting, for sharing with the forum members and guests, a zipped file which contains the following:

    8+8 IO expander.pdf (user manual & schematics)
    I2C_Expander_2.hex (I2C address device # 2)
    I2C_Expander_3.hex (I2C address device # 3)
    I2C_Expander_4.hex (I2C address device # 4)

    Hope you will find it useful

    Al.
    Attached Files Attached Files
    Last edited by aratti; - 27th November 2008 at 12:44.
    All progress began with an idea

  2. #2
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Except for the stepper motor functionality you built into the 876, you could use an MCP23018 as an 8/16 bit I/O expander. No code, oscillator needed at about 1/3 the price.
    http://www.microchip.com/wwwproducts...cName=en537375
    Device Description 16-bit I/O Port Expander
    Operating Voltage Range (V) 1.8 to 5.5
    Operating Temp Range (°C) -40 to 125
    Interface I²C™
    Max. Bus Frequency (kBits/s) 3400
    16-bit remote bidirectional I/O port
    Open-drain outputs: - 5.5V tolerant - 25 mA sink capable - 400 mA total current out
    High-speed I2C™ interface up to 3.4 MHz
    Single hardware address pin: Voltage input to allow up to eight devices on the bus
    Configurable interrupt output pins: active-high, active-low or open-drain
    Low standby current:1 μA (typ.)

  3. #3
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Improved triangolar profile

    The profile algorithm transforms the travel command (steps) into three vector quantities:

    Vector A Acceleration from rest to fixed speed (vector slope defined by ramp)
    Vector B travel at fixed speed from end of vector A to begining of vector C
    Vector C Deceleration from fixed speed to rest at target point (Vector A inverted)

    This technique is known as "TRAPEZOIDAL PROFILE".

    When the travel command is equal or less than vector A + vector B
    the algorithm convert the trapezoidal profile into "TRIANGULAR PROFILE"
    calculating new vectors A & B with different slopes as function of the given travel command

    For small travel command (few steps) the algorithm was yielding incorrect sharp slopes that
    could stall the motor if requested to turn at high speed.

    The bug has been found and removed!

    Now the motor turns smootly also with few steps travel command at high speed setting.

    The new version software (IO_Expander_new) is attached, as a zipped file, to this post.
    Attached Files Attached Files
    All progress began with an idea

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,803


    Did you find this post helpful? Yes | No

    Default

    Great project! Congratulations and a big thank you for sharing your project with us.

    I'd like to ask about the reliability of the I2C in the industrial environment. Is robbust enough to trust it in a place that are interference of every kind around?

    I prefered to use the old classic SIPO and PISO chips and techniques, but I am willing to change into I2C if it is at least at the same level too.

    Ioannis

  5. #5
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Ioannis , I have more than 20 automations working with I2C installed in different places and all works pretty well. If you want give a try do it, providing that you optoisolate the digital part (inputs & outputs) from the external power devices (motor; valves; relays and sensors of any type).

    Al.
    All progress began with an idea

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,803


    Did you find this post helpful? Yes | No

    Default

    Thanks for the reply.

    I have some projects where the inputs are optoisolated, outputs are relays and analog drive directly the PIC inputs through some sort of zener diode protection.

    For the digital part I use the Parallel input-Serial Output and the reverse, Serial Input-Parallel Output registers like the 4021 and 4094 or the A6841/MIC6841 that drives relays directly. Especially the latter is a good IC and drives relays with no need for other components. I wonder if there is an equivalent in I2C.

    This registers need at least 5 lines for data-in, data-out, clock, strobe and load. That is why I think to jump into I2C.

    Regards,
    Ioannis

Similar Threads

  1. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 22:31
  2. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  3. Another I2C Slave Routine Problem
    By DanPBP in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th February 2009, 05:50
  4. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 19:33
  5. Disable MCU Extra Features
    By cjurczak in forum General
    Replies: 2
    Last Post: - 17th November 2006, 17:51

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts