Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: Arduino and MBI5027 shift registers

  1. #11
    Join Date
    Nov 2009
    Location
    Morrisburg, On, Canada
    Posts
    2,540
    Post Thanks / Like

    Default Re: Arduino and MBI5027 shift registers

    Did you ground pin 21 on the MBI5027?
    What value of resistor do you have on pin 23 of the MBI5027?
    Did you change the polarity of Arduino pin 6 as the data sheet says, i.e pin 6 LOW = LATCH, pin 6 HIGH = shift?

  2. #12
    Join Date
    Nov 2009
    Location
    Morrisburg, On, Canada
    Posts
    2,540
    Post Thanks / Like

    Default Re: Arduino and MBI5027 shift registers

    Quote Originally Posted by dslynx View Post
    ."... except, it's not an "if you want", it's a "MUST".. .
    Yes a resistor is a must, but what I meant was that 10ma requires an 1800 ohms but a 20 ma current requires 900 ohms. I didn't know what current value you wanted, hence the "..if you want...".
    Last edited by LightUp; 12-20-2018 at 01:17 AM.

  3. #13
    Join Date
    Dec 2009
    Location
    Yoder, CO
    Posts
    121
    Post Thanks / Like

    Default Re: Arduino and MBI5027 shift registers

    Pin 21 is grounded. I will clarify tonight if this is actually needed. I believe a floating ground is good enough.
    Pin 23 has a 1.5k resistor.
    6 LOW = Latch and HIGH = Shift, this is a tricky one. I did swap it like you suggested, but after fiddling with it, I believe the timing diagram may be correct. I'm going to clarify everything this evening and post everything I learned on my blog for future reference. I hate learning the same thing twice. I tried doing HIGH during the shift and LOW to latch, but the lights were flickering while it was shifting data. When I take pin 6 LOW, shift the data, and then HIGH to latch, it turns on the output pins that I shifted in. But again, I will verify this evening that what I am saying is correct.

  4. #14
    Join Date
    Dec 2011
    Location
    UK S80 postcode
    Posts
    1,386
    Post Thanks / Like

    Default Re: Arduino and MBI5027 shift registers

    Hi, good to hear things are starting to come together. As your code progresses donít forget to swap round /OE and LATCH to blank the output before you latch the new data. I know you stated you did this to observe the latching, it shouldnít make much difference in your application but itís good practice to ensure all the outputs update at the same time.
    Code:
      digitalWrite(7, HIGH); // 16th bit
      delay(10);
      digitalWrite(7, LOW);
      delay(10);
      digitalWrite(6, HIGH); // LATCH!
      digitalWrite(13, HIGH);
      delay(10);
      digitalWrite(6, LOW); // LATCH!
      digitalWrite(13, LOW);
      delay(10);
      delay(1000);
    Code:
      digitalWrite(7, HIGH); // 16th bit
      delay(10);
      digitalWrite(7, LOW);
      delay(10);
      digitalWrite(13, HIGH);
      digitalWrite(6, HIGH); // LATCH!
       delay(10);
      digitalWrite(6, LOW); // LATCH!
      digitalWrite(13, LOW);
      delay(10);
      delay(1000);

  5. #15
    Join Date
    Dec 2009
    Location
    Yoder, CO
    Posts
    121
    Post Thanks / Like

    Default Re: Arduino and MBI5027 shift registers

    Ok, I have confirmation! My original build log is quite lacking. Lots of pretty pictures, but actual instruction is poor.

    Pin 21 is grounded and that is required. (it's on my prototype, but I can't see it on my PCBs because the trace is under the 5027 socket from 21 to 1)
    Pin 23 needs a connection to ground either with or without a resistor. My PCBs have a 1.5k resistor, my prototype just ties to ground and looking at the original Grinch PCB trace layout (that I used for reference), it also ties pin 23 directly to ground without a resistor.
    Latching... Confirmed that the timing diagram is correct. Current sketch is latch LOW, shift in the data, latch HIGH, the correct output pins light, they stay light while latch goes LOW, shift in more data, take it HIGH and the output pins light up.

    Taking the latch HIGH and shifting in the data makes the LEDs flicker as the data is shifted in. Definitely not what we want.

    Next step will be to update the Arduino code to interface with Vixen. I tested some code I found (not really happy with it's design) and it worked for the most part.

    This is what the end results of the sketch looks like. Basically, I am shifting in 10101010... back and forth, so I can watch the LEDs go on and off. The Yellow/Blue/Green notes for the 2/3/4 pins on the chip are because I put that color LED on each of those pins to watch them go HIGH/LOW.

    Code:
    void setup() {
      // initialize digital pin 13 as an output.
      pinMode(5, OUTPUT); //SDI (2) Yellow
      pinMode(6, OUTPUT); // Clock (3) Blue
      pinMode(7, OUTPUT); //Latch (4) Green
    }
    
    // the loop function runs over and over again forever
    void loop() {
      digitalWrite(7, LOW);  // Latch
      digitalWrite(5, LOW);   // SDI Low
      delay(17);
      digitalWrite(6, HIGH); // 1st bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, HIGH);   // SDI High
      digitalWrite(6, HIGH); // 2nd bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, LOW);   // SDI Low
      digitalWrite(6, HIGH); // 3rd bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, HIGH);   // SDI High
      digitalWrite(6, HIGH); // 4th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, LOW);   // SDI Low
      digitalWrite(6, HIGH); // 5th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, HIGH);   // SDI High
      digitalWrite(6, HIGH); // 6th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, LOW);   // SDI Low
      digitalWrite(6, HIGH); // 6th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, HIGH);   // SDI High
      digitalWrite(6, HIGH); // 8th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, LOW);   // SDI Low
      digitalWrite(6, HIGH); // 9th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, HIGH);   // SDI High
      digitalWrite(6, HIGH); // 10th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, LOW);   // SDI Low
      digitalWrite(6, HIGH); // 11th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, HIGH);   // SDI High
      digitalWrite(6, HIGH); // 12th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, LOW);   // SDI Low
      digitalWrite(6, HIGH); // 13th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, HIGH);   // SDI High
      digitalWrite(6, HIGH); // 14th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, LOW);   // SDI Low
      digitalWrite(6, HIGH); // 15th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, HIGH); //SDI HIGH
      digitalWrite(6, HIGH); // 16th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(7, HIGH); // LATCH!
      delay(3000);
      digitalWrite(7, LOW);  // Latch
      digitalWrite(5, HIGH);   // SDI High
      delay(17);
      digitalWrite(6, HIGH); // 1st bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, LOW);   // SDI Low
      digitalWrite(6, HIGH); // 2nd bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, HIGH);   // SDI High
      digitalWrite(6, HIGH); // 3rd bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, LOW);   // SDI Low
      digitalWrite(6, HIGH); // 4th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, HIGH);   // SDI High
      digitalWrite(6, HIGH); // 5th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, LOW);   // SDI Low
      digitalWrite(6, HIGH); // 6th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, HIGH);   // SDI High
      digitalWrite(6, HIGH); // 6th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, LOW);   // SDI Low
      digitalWrite(6, HIGH); // 8th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, HIGH);   // SDI High
      digitalWrite(6, HIGH); // 9th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, LOW);   // SDI Low
      digitalWrite(6, HIGH); // 10th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, HIGH);   // SDI High
      digitalWrite(6, HIGH); // 11th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, LOW);   // SDI Low
      digitalWrite(6, HIGH); // 12th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, HIGH);   // SDI High
      digitalWrite(6, HIGH); // 13th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, LOW);   // SDI Low
      digitalWrite(6, HIGH); // 14th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, HIGH);   // SDI High
      digitalWrite(6, HIGH); // 15th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(5, LOW);   // SDI Low
      digitalWrite(6, HIGH); // 16th bit
      delay(17);
      digitalWrite(6, LOW);
      delay(17);
      digitalWrite(7, HIGH); // LATCH!
      delay(3000);
    }
    And, a pic of it working:

    Arduino-5027-testing.jpg

  6. #16
    Join Date
    Dec 2012
    Location
    Hudson MA
    Posts
    3,527
    Post Thanks / Like

    Default Re: Arduino and MBI5027 shift registers

    Look at the JCOOK code. It has a state machine and minimal delay between received data and output.


    2019 - Going to visit my Daughter in New Zealand (again). I will be dark for the 2nd year in a row. Sigh..

  7. #17
    Join Date
    Dec 2009
    Location
    Yoder, CO
    Posts
    121
    Post Thanks / Like

    Default Re: Arduino and MBI5027 shift registers

    Quote Originally Posted by MartinMueller2003 View Post
    Look at the JCOOK code. It has a state machine and minimal delay between received data and output.
    I've seen mention of the JCOOK code, but nobody seems to link to it. I've searched around and the only thing I can find from JCOOK is code for an EL Sequencer. Searching the forum for "arduino" and user "jcook" doesn't seem to turn anything up. Any help would be appreciated.

  8. #18
    Join Date
    Dec 2012
    Location
    Hudson MA
    Posts
    3,527
    Post Thanks / Like

    Default Re: Arduino and MBI5027 shift registers

    Here is a link to the thread.

    http://doityourselfchristmas.com/for...hlight=el-wire

    The xbee is simple a way to get serial data to the uno.


    2019 - Going to visit my Daughter in New Zealand (again). I will be dark for the 2nd year in a row. Sigh..

  9. #19
    Join Date
    Dec 2009
    Location
    Yoder, CO
    Posts
    121
    Post Thanks / Like

    Default Re: Arduino and MBI5027 shift registers

    Yeah! Finally have working code with the help of my brother. Using the jcook code as a base, this is what we came up with. I have only tested it with Vixen 2.5 because that is what all my sequences are built in, so right now, that is all I care about. But, I believe it should also work with Vixen 3.x without issues.

    Code:
    #include <Shifter.h>
    
    // Pins connected to shift register(s)
    #define SERIAL_Pin 5 //SDI (Pin 2)
    #define CLOCK_Pin 6 // Clock (Pin 3)
    #define LATCH_Pin 7 // Latch (Pin 4)
    
    // Number of channels to control, should be a multiple of 8 or 16
    // depending on the type of shift register(s) used.
    // Must be less than or equal to 200 channels using the
    // Arduino shifter library
    #define CHANNELS 32
    
    //intensity value to turn on channels
    #define CHANNEL_TRIGGER_LEVEL 128
    
    //set output status
    #define CHANNEL_ON HIGH
    #define CHANNEL_OFF LOW
    
    Shifter shifter(SERIAL_Pin, LATCH_Pin, CLOCK_Pin, CHANNELS/8);
    byte FrameHeader[] = "Snoodle";
    byte FrameHeaderLength = sizeof(FrameHeader) - 1;
    byte FrameHeaderIndex = 0;
    int CurrentChannelIndex = 0;
    
    void setup() {
        Serial.begin(57600);
        // set up for a new frame
        FrameHeaderIndex = 0;
        CurrentChannelIndex = 0;
    
        // Start with all registers cleared.
        shifter.clear(); //set all pins on the shift register chain to LOW
        shifter.write(); //send changes to the chain and display them
    }
    
    void loop() {
        // Is there data to process?
        while (Serial.available() > 0) {
            // Yes, are we looking for the frame header or processing data?
            if (FrameHeaderIndex < FrameHeaderLength) {
                // Looking for the frame header
                if( Serial.read() == FrameHeader[FrameHeaderIndex]) {
                    // Matching so far...
                    ++FrameHeaderIndex;
                } else {
                    // not the expected value. Start searching at the beginning again
                    FrameHeaderIndex = 0;
                }
            } else {
                // Processing data
                shifter.setPin(CurrentChannelIndex, (Serial.read() < CHANNEL_TRIGGER_LEVEL) ? CHANNEL_OFF : CHANNEL_ON);
                ++CurrentChannelIndex;
    
                // Did we get settings for all of the channels?
                if (CurrentChannelIndex == CHANNELS) {
                    // Yes, send out the data.
                    shifter.write();
                    CurrentChannelIndex = 0;
                    FrameHeaderIndex = 0;
                } // Nope, keep getting more data over the serial port.
            }
        }
    }
    So, because I hate having to learn this stuff again, I have updated my blog to include all the steps I went through to get it working in a test environment.

    MBI5027 with Arduino to verify everything is setup correctly

    Vixen -> Arduino -> Snoodle/Grinch/595/shift register
    Last edited by dslynx; 01-01-2019 at 04:13 PM. Reason: Removed 2.5 from link name, it works perfect with Vixen 3.x as well.

  10. #20
    Join Date
    Nov 2009
    Location
    Morrisburg, On, Canada
    Posts
    2,540
    Post Thanks / Like

    Default Re: Arduino and MBI5027 shift registers

    Good to hear you have it working.
    Grounding pin 23 provides practically no current limit on your outputs. So it is depends on what you connect to an output and the source voltage. For example, if you used a LED on the output driven from a 5V source, with pin 23 using an 1800 ohm-to-ground resistor, the LED current will be limited to 20mA. If you ground pin 23 your LED current could be forced to draw 90mA, or more. This could destroy your LED. So, use this pin 23 with some prudence as per datasheet, and not simply ground it. Other readers may misunderstand this feature.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

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