Use a single TPIC6B595 for one or two of those flipp'n things, and try to write code for that that.
If you can, only then think of up-scaling.
Leo..
Its been a few weeks, I've received my order from Digi key. I have 5 DIP TPIC shift registers and 3 28BYJ-48 unipolar stepper motors. I have reviewed the post about the BMW sculpture and learned quite a bit. I have wired the first TPIC to the Arduino Nano according to the commented section of Wawa's example code, and wired the motor according to Crossroad's schematic somewhere in that BMW post. The red wire in connected to 5v, Orange to 4 of TPIC, yellow to 5, pink to 6 and blue to 7. I've double triple quadruple checked my wiring and it all seems correct with the information I have, but when uploading Wawa's example code, nothing happens. I've tried my very best to reverse engineer what was going on in that section of code, but I'm not too sure how it works. I understand the switch case, I understand all of the variables, but I don't understand how the Arduino communicates with the TPIC on what to do, and when to set the register. The TPIC is getting 5v correctly, and the motor is also getting 5v correctly. I have a heavy inclination that the problem is my misunderstanding of the code. Any and all suggestions are welcome
Thanks
- Jared
alianellj:
I've double triple quadruple checked my wiring...
Well, we didn't.
Please upload a picture of the setup, showing ALL the connections.
And the exact code you're using, inside code tags.
Google "28BYJ-48 step sequence".
There are several ways to step this motor, but usually two coils are energized at the time in full step mode.
Also learn about shift registers. Many examples for the 74HC595, which is almost the same as a TPIC.
You basically send a byte (8 bits) to the chip, which then gets transferred to the eight outputs.
The right value nibble (4 bits, or half a byte) pulls the right motor pin(s) to ground.
An array of bytes is needed to drive many chips/motors. Extra bytes sent are passed on to the next chip.
It's like chairs in a theater. The first one in ends up on the last seat.
Leo..
Wawa:
Well, we didn't.
Please upload a picture of the setup, showing ALL the connections.
And the exact code you're using, inside code tags.Google "28BYJ-48 step sequence".
There are several ways to step this motor, but usually two coils are energized at the time in full step mode.Also learn about shift registers. Many examples for the 74HC595, which is almost the same as a TPIC.
You basically send a byte (8 bits) to the chip, which then gets transferred to the eight outputs.
The right value nibble (4 bits, or half a byte) pulls the right motor pin(s) to ground.An array of bytes is needed to drive many chips/motors. Extra bytes sent are passed on to the next chip.
It's like chairs in a theater. The first one in ends up on the last seat.
Leo..
Here is some simple code I found from another user trying to use TPIC shift registers as well from here.
/*
Nano | TPIC6B595
5V | 2 (VCC)
GND | GND
D8 | 8 (SRCLR)(Pulled high to 5v rail)
D10 | 12 (RCK)
D11 | 3 (SER IN) of the first chip
D12 | 13 (SRCK)
| 9 to GND
| 10, 11,19 to GND
| 18 (SER OUT) to 3 of the next chip
*/
#include <SPI.h>
#define DATA 11 //Ser in - serial data input TPIC: 3
#define LATCH 10 //RCK - Register clock TPIC: 12
#define CLOCK 12 //SRCK - Shift register clock TPIC: 13
int digits[] = {
1000,
1100,
0100,
0110,
0010,
0011,
0001,
1001,
};
void setup() {
pinMode(DATA, OUTPUT);
pinMode(LATCH, OUTPUT);
pinMode(CLOCK, OUTPUT);
Serial.begin(9600);
}
void loop() {
int i;
for (i = 0; i < 8; i++) {
Serial.println(i);
digitalWrite(LATCH, LOW);
shiftOut(DATA, CLOCK, MSBFIRST, digits[i]);
digitalWrite(LATCH, HIGH);
delay(1672/4);
}
}
and here is an image of my current configuration 3/22/21
https://imgur.com/a/3XKmIYi
The step sequence was derived from an RPI post here.
The color of wires and their connection to the TPIC are as follows:
NC 1 : U : 20 NC
5V+ (ORANGE) 2 : : 19 (PURPLE) G
D11 (RED) 3 : : 18 NC
M0 (BLACK) 4 : : 17 NC
M1 (WHITE) 5 : : 16 NC
M2 (GRAY) 6 : : 15 NC
M3 (PURPLE) 7 : : 14 NC
5V (BROWN) 8 : : 13 (BLACK) D12
G (WHITE) 9 : : 12 (GREEN) D10
G (YELLOW) 10 :___________: 11 (YELLOW) G
I like your explination of theater seating, Thanks Wawa.
I guess a flip display needs very little motor torque, and half-stepping (4096 steps) is not needed for 64 cards.
So drive ONE coil at the time (not two), and take only four steps (not eight).
Then you should be able to flick through all 244*64 cards in <= 6 seconds.
ShiftOut could be too slow if you upgrade to 244 units.
Better start with SPI now.
Both techniques are used/explained in the final code I posted in the "BMW Kinetic Sculpture" thread.
Leo..
Hi,
A proper circuit diagram would be advantageous here.
Can you please draw a diagram and post a picture of it?
Include power supply wiring and please label components and pins.
Thanks.. Tom... ![]()
TomGeorge:
Hi,
A proper circuit diagram would be advantageous here.
Can you please draw a diagram and post a picture of it?Include power supply wiring and please label components and pins.
Thanks.. Tom...
This is the first schematic I've ever made, I'm sure I broke about 30 rules everyone follows when making schematics, but I hope this is clearer than ascii art lol. Eagle wouldn't let me show the ground connections on the TPIC as they assumed I wanted them grounded?
Wawa:
I guess a flip display needs very little motor torque, and half-stepping (4096 steps) is not needed for 64 cards.
So drive ONE coil at the time (not two), and take only four steps (not eight).
Then you should be able to flick through all 244*64 cards in <= 6 seconds.ShiftOut could be too slow if you upgrade to 244 units.
Better start with SPI now.Both techniques are used/explained in the final code I posted in the "BMW Kinetic Sculpture" thread.
Leo..
<=6 seconds is a good time. Thank you for the early notice that ShiftOut may be too slow before I perused that idea too far.
Digital chips, like the TPIC, always need a ceramic capacitor between VCC and ground, close to the chip.
100n might do for experimenting on a breadboard.
I have used one 4.7uF MLCC per chip on my 48-motor boards, to prevent dips in VCC during mosfet switching.
Leo..
Wawa:
Digital chips, like the TPIC, always need a ceramic capacitor between VCC and ground, close to the chip.
100n might do for experimenting on a breadboard.
I have used one 4.7uF MLCC per chip on my 48-motor boards, to prevent dips in VCC during mosfet switching.
Leo..
Do you think this is the reason the tpic seems to be sending no pulses? I will order some 100nf ceramic caps today.
The TPIC outputs can only sink current, not source. Pullup resistors are required on all output pins.
DrDiettrich:
Pullup resistors are required on all output pins.
Nonsense.
I tried to interpret the "sending no pulses". One possible reason is a missing load, another one might be a too short LOW time. Provided that the outputs are latched and enabled...
DrDiettrich:
I tried to interpret the "sending no pulses". One possible reason is a missing load, another one might be a too short LOW time. Provided that the outputs are latched and enabled...
If I'm correct, the TPIC is only connecting ground between the motor and 5V to power each coil. If this is wrong and the TPIC is sending 5V to the motor instead of connecting ground, what would happen if I grounded the 5V wire of the motor and powered each coil "backwards"?
The motor connection to a positive voltage is okay, no pullup required in this case. Swap supply + and - in the circuit diagram and see what happens.
I still wonder how you detect the "no pulses" case.
Don't see what could happen if you do it wrong.
The TPIC only has switches to ground, same as the ULN chips that usually come with the motors.
The TPIC does not have switches to 5volt, so can't put 5volt on the motors.
An 28bjy-48 motor has five wires. The one in the middle (red?) must be permanently connected to 5volt.
The other four are switched in pairs (or one at the time) to ground, thus supplying the motor with power.
That sequence must be done right. Right pairs (or single coil), with a minimum time in between to give the motor time to move.
Leo..
DrDiettrich:
The motor connection to a positive voltage is okay, no pullup required in this case. Swap supply + and - in the circuit diagram and see what happens.I still wonder how you detect the "no pulses" case.
Wawa:
Don't see what could happen if you do it wrong.The TPIC only has switches to ground, same as the ULN chips that usually come with the motors.
The TPIC does not have switches to 5volt, so can't put 5volt on the motors.An 28bjy-48 motor has five wires. The one in the middle (red?) must be permanently connected to 5volt.
The other four are switched in pairs (or one at the time) to ground, thus supplying the motor with power.
That sequence must be done right. Right pairs (or single coil), with a minimum time in between to give the motor time to move.
Leo..
In that case excuse the pulses thing earlier. I assumed "No Pulses" because the motor isn't even making a jitter or click as if there was any power to the motor at all. I connected the red to 5V and just manually plugged each of the 4 negative wires into the ground power rail just to see what it sounds like if there's any power at all in the motor. When running the most basic form of code I can find for a shift register, there's absolutely no power in the motor and no noise at all.
Didn't look closely at your build yet, but I hope you realize you have a breadboard with interrupted power rails.
Look at the blue and red lines.
Leo..
Wawa:
Didn't look closely at your build yet, but I hope you realize you have a breadboard with interrupted power rails.
Look at the blue and red lines.
Leo..
Yes, it took me awhile to figure that out
I have jumpers connecting the interrupts
Please understand that only one of each pair of coils can be powered with an unipolar stepper motor. Powering both of a pair extincts the magnetic field with consequently no move nor brake.
And not all 28byj-48 motors are created equal (by the same manufacturer).
Wiring/colours can be different, so you might have to experiment if the motor is not running.
Leo..
