I made an Arduino sketch to control the little stepper motor completely with only ONE input!
Connect a dimmer bit to analog input A2 and you can control speed and direction.
When the speed is zero, then the direction changes. Huh?
This sketch could very easy be loaded into your ATtiny chip.
(I have seen you have 4 outputs for the motor and only one input for control).
That’s pretty awsome Alex, (@alexpikkert)
It would make a great analog of the “swing” mode of the servo bit. You have used the littleBits’ design concept of “immediate control [over[ complete control” very nicely with this design.
Some of my project ideas need more control though, so I determined that I will need a second input when under digital control, so I switched over to a Tiny 84 with ten* IO pins. I hope to have some show & tell in a day or two.
I’m done designing and building the stepper module for now. It performs as specified in this post, above (with a single input analog mode, and a dual input ‘arduino’ mode). The motor runs flat out at slightly less than 12 RPM, with plenty of torque at 5 volts. The design allows a motor input voltage of up to 36 volts. This means that motors much bigger than the diminutive 28byj48 can be used. However, this one runs at 5 volts, which is supplied through the input bitSnap connector(s).
I’ll post an awesome project using this module soon!
Great teaser diagram! I think a new bit is born ! Mr. Stepper.
After careful studying your drawing:
Maybe it is safer to put blocking diodes in the VDD line and in the VCC line in the area of the jumper. (to avoid that someone can put 36 Volt on VDD and keeps the jumper in so our poor Littlebits will be fried). Using a diode in each line (VDD and VCC) will protect against this unwanted interference.
To be able to connect a VDD power source, I think you also need a GND connection.
What is the function of the “OUT” connection on d8?
Do I read your diagram correctly?
When da5 is low, pulses on sig are going to da6 via opamp 2.
frequency determines speed, amplitude determines direction.
Aux is not important here. when left floating it is pulled to HIGH
When da5 is high, pulses on sig are going to da4 via opamp3
frequency determines speed.
and aux is high or low, determining direction via opamp1 to da7.
If aux is left open, it is pulled to high.
@chris101 This image is so pretty. I love how you color coded the diagram wires. That’s really handy for when you need to return to your design after clearing your head for a few days. Plus, you get extra style points for that breadboarded micro-switch!
@Arjun, check out this pic!
Your analysis of the circuit is correct @alexpikkert. Op-amp 3 is set up so the pulses are fixed - they have sharp leading and falling edges - anything greater than 1 volt is output at 4 volts, less than 1v, stays at zero. (That is the reason for the 1 volt divider you see on the minus input.)
Op-amps 1&2 are normal followers - they are there to get the impedance right and isolate the circuit. The LM324 amps go down to ground just fine, but only go up to 4 volts (that’s what the oscilloscope says - although I measured it at 3.9 volts with a littleBits circuit.) Either way it’s fine, since it is read as a HIGH signal.
I also thought about diodes for the power into the motor. I didn’t do it because the diodes I have (1N4001, '04, '07, 1N914 and 1N4148) all drop the voltage by almost a volt. With the diode in, the little 28byj48 motor had a hard time running on 4.05 volts. The speed dropped a lot, and it stalled often. So, for now, I won’t use anything except 5 volts without a diode, and I will probably leave it that way. As a “Bit”, I think it is more in line with the rest of the system, operating at 5 volts anyway. (It’s nice to know that the design is amiable to higher voltage motors though.)
As for the output connection …
So far, it doesn’t do anything. The standard is to just pass the pulses from the main input through, but I’d like to be a bit more creative with it. Perhaps it could indicate the position of the motor, relative to it’s position at the start of operation. Pin 8 says it’s pwm, so I.m thinking about outputting a voltage that is proportional to the angle of rotation. (adding/subtracting according to the direction.) But the motor is more granular than is the Tiny’s output precision (1024 steps per revolution, vs 256 discrete output values.) So far, I haven’t used the module as anything except the terminal Bit, so this hasn’t come up yet …
By the way, I have been playing with the timing of the coil energizing today, and have the speed up to 14 rpm! And I think I may be able to squeak a little more too. It seems that if I optimize for highest speed, the reliability at very low speeds suffers. I don’t fully understand why.
Hold on to your horses!
Thanks again for your interest and very valuable assistance with this project Alex! I will try to post a fun project later tonight* or tomorrow using the stepper bit!
EDIT: it’ll have to be tomorrow or so, I discovered that I need a vital part, and the stores are all closed.
Thanks Jude! I almost like the wiring diagram as much as the actual circuit, although the diagram does not move.
You’re right that a clear, annotated picture helps me understand what I was thinking. I also wanted this to be a project for anyone else who wanted to build one for themselves. In the unlikely event that this would get all the way through the bltlab process, it would still be a very long wait until it was available.
I originally had a bigger switch, but it was SPDT, and I really needed a DPDT. When I saw the little switch at the parts store, I got it only to discover the ‘feet’ were WAY too close together to plug in, so I made an extender board for it. And that made it possible to stack components. Here’s what is going on under the switch:
Hi Chris @chris101,
There are diodes with a voltage drop much lower than the ones you mentioned, Schottky diodes. (WOW, 0.2 Volt !)
I have just posted a project made with the ‘completed’ stepper bit:
Hi Chris @chris101,
Ha! … Yeah, I wish.
I love it, Chris! I can’t help but think how living with this clock would change my perception of time.
BTW, is there audio in your second video? I wouldn’t want to miss an explanation about the World Clock resetting.
Oh, and here’s another question… What if a curious person picks up the globe and puts it back incorrectly? Could there be a way to reset it then, rather than waiting for the daily reset?
Good idea Jude @JackANDJude,
Maybe a light sensor could do this trick. There is still an additional input available on the arduino…
Thanks Jude! @JackANDJude
I didn’t talk on either video, but I probably should have - that second one is so l-o-o-o-o-ong! Maybe some music would help it as well. I should put the sunrise theme of the Grand Canyon Suite on the sunrise video.
The clock only knows one time to reset to, but it could readjust that time by adding hours and minutes. There is indeed one more input - perhaps a dimmer could set the time to readjust to? Use a couple number bits to set hrs and minutes to add to (or subtract from) the reset time. To get all of that, i’ll need to use those additional I/O lines from the ‘holes’.
Hi Chris @chris101, Jude @JackANDJude,
Could it be solved this way:
When the Arduino resets daily, it can start remembering the time passed since restart. (Stored in a variable).
Input A0 is still free and could be set to check a light sensor or a roller switch. When activated when someone takes the globe away from the box and replaces it, the reset procedure starts again but adds the time difference as stored by the Arduino memory…
Just a quick brainlightning, dont know if it really will work…
If you look at the ‘dream bits’ section of the bitLab, you see a time of day bit is often posted. We need some sort of clock bit to use here:
Here is the schematic for the new version of the stepper bit:
Please let me know if you see anything wrong!
@chris101 did you update your submission to bitLab? I found I was able to do that when I made changes before they published my submissions. It made me happy.
I’ve been wondering if I should do exactly that, but I have not. Here’s my thinking: Version 1 of the stepper bit - er, module that is - is simple and easy. It’s got one input and one output (the input pulses are passed unchanged to the output.) You send it pulses from anything except an arduino bit and it performs exactly as expected. You send it low frequency pulses and it turns slowly, you up the frequency, and it speeds up. Low amplitude pulses turn it to the right, high voltage turns it to the left. Nothing fancy, it just turns.
Then I got into trying to make it pay attention to
the pwm-y pulses from the Arduino,
Yuck, right? I spent way too much time trying to make those pulses conform to what my hardware could read, but it lead nowhere. Finally I acquiesced to the obvious solution, and built the current two input version. (Note that I included a switch that would revert the module back to a single input bit.) Version two is faster, more robust, and better protected from interference and does not interfere with it’s fellow bits. It even draws slightly less current for more torque! It’s a better machine!
What it is not is simple. Users need to understand the pulsed nature of the input, they need to control two inputs - frequency AND direction, and they need to plan for this bit more than if they were just attaching a motor. So from the aspect of providing immediate control over more complete control, I think the version 1 module has a better chance of being accepted as a bit. If not, then I will submit version 2 as a follow-up, depending on the feedback I get from the littleBits engineering team.
Or I may just make it a project itself, and include step-by-step instructions on making one as a DIY project, the total cost of the parts - at RadioShack prices was about $50, so most littleBits customers can afford to make one. I used a solderless breadboard, so poor manual skills are not a problem.
If I were to be selected, and garner 1K vote, then I would need to look into hiring some help to put the thing together in the format littleBits asks for in their bitlab documentation. I couldn’t, for example, imagine soldering a surface mount opamp with my clunky 35 watt soldering iron! Or even using the official on-board processor, the tiny2313 (in surface mount … of course!)
So for the time being, I will let my original design work it’s way through the bitProcess. I think it’s a good design, and one that fits with other bits - AND littleBits audience - better than my more powerful version 2 motor controller.