Hi guys.
Fun project , but I need some help and guidance please.
OK .. so my wife and sister in-law are keen cake bakers and decorators.
I want to build them a cake decorating turn table that has a foot switch to:
have a go stop with a speed setting knob.
Have an indexing : so when you press the foot switch it will turn a set amount according to what one has set the number of stops in one rotation (indexing)
Here are my questions. and what I was thinking so far
I will print a big belt gear to go on the bottom of an Ikea lazy susan.
then will drive it with a nema 17 motor
using an Arduino but here I have no idea as there are now so many.
this will then need a shield or something to mount a driver on to drive the motor
then have a foot pedal
then have two knobs
one for speed of rotation
one for number of index points.
power supply
So then they will be able to hold the icing bag with both hands and tort the cake with their foot.
any and all help would be great.
What I will be doing this week end is drawing up a belt gear for the lazy susan, and a motor mount. Then when I know what arduino to use and driver shield or board I can incoperat that and a power supply and a plug for the foot pedal.
Forget the main project. That is the final result. For now you need to think about the principles. You need to work on motors and understand the different types and how to code them. A foot switch is still a switch and you can stick a 2 penny button on a breadboard. Get a nano or whatever cheap and small uController you can find as this project is trivial for a uC and any will do it.
Design, flow chart, research. Code in discrete small chunks. Save to new file names often. Use a naming scheme that means something. Only do one component in a sketch then amalgamate at the end. Consider how to make tight encapsulated code that is not vulnerable to global variables and interference in the main loop
Once you have a mock up on a bread board, and have learnt all the many problems and solved them, then think about your first real life prototype.
Bad idea...most are mains supply motors and no indexing.
Op is on the right track but seems to think someone will offer up all the design details and code.
Have to mention, "NEMA 17" tells us essentially nothing apart from the fact that it is a stepper - fair enough - and how big its faceplate is.
Recommend not a UNO, but a basic Nano.
Well, if there was a "shield" with a suitable driver, it would go with a UNO, but I seem to recall that the motor driver shields offered are not recommended by most advisors here. I may be wrong.
One rotary encoder would do the job. You may want to have a display - a "1602" with an I²C "backpack".
Attach one wire from the foot pedal to the 5V pin on the Arduino
Attach the other to pin 2 on the Arduino and add a 10k resistor to GND
Code:
const int pedalPin = 2;
void setup(){
pinMode(pedalPin, INPUT);
Serial.begin(9600);
}
void loop(){
int pedalState = digitalRead(pedalPin);
if(pedalState = HIGH){
Serial.println("Pedal Pressed!");
}else{
Serial.println("Pedal not pressed.");
}
}
Now open up the Serial Monitor (⌘ + ⇧ + M on mac or ctrl + shift + M on windows)
Press the pedal. The serial monitor should show the state of the pedal!
Help with knobs:look at post 18 for info on rotary encoders and IC2 LCDs
Open up the serial monitor. Turn the knobs. You should see the values change from 0 (all the way counterclockwise) to 1024 (all the way clockwise)!
Help with stepper motor:
One question before we get going: what voltage does your stepper motor operate at?
Also, the stepper motor driver depends on stepper motor voltage.
Let's not make it too complicated. I think it's better to have two simple potentiometers. A rotary encoder and an LCD and quadruple the code for the user interface is too overkill. You could do it if you want, though .
Isn't it easier to connect one side of the switch to ground and the other to an input set to pinMode INPUT_PULLUP to enable the internal pullup? No external resistor needed.
And no "hot" Vcc wire running to the switch.
Add a 0.1uF cap across the switch to filter noise and add hardware debounce.
I think an encoder is much more useful than a pot in this case. The added code is worth it.
A stepper motor can be run slow (one step at a time) so it doesn't have to be geared-down. And the software can keep track of the steps so it knows when to stop. Usually there is a "home" sensor and sometimes an "end" sensor so it can find the starting-point but that shouldn't be necessary in this application.
A standard stepper has 200 steps per revolution (1.8 degrees per step). That should be enough resolution but you might want to gear it down for smaller steps to get smoother operation.
You can also buy "gearmotors" which are regular DC motors with an attached gearbox. You'd either need a rotary encoder, or a sensor every so-many degrees.
...If this was me, I'd just hook-up a gearmotor to a footswitch (or maybe two footswitches if it really needs to go both directions). I wouldn't use a microcontroller.
Work on pots first, then try a rotary encoder (you could also have a setting for direction), and if it works before the deadline, implement it into the project. Otherwise, use the pots.
No, use INPUT_PULLDOWN or have the button connected to GND and use INPUT_PULLUP.
In current project I am using a 100 uF capacitor to filter noise. Uh oh.
Yes, they can be slow, but it would be impossible to have to put detailed icing spots on a 60 rpm cake.
It's simpler, but not worth it. More of a learning experience. It's up to @thebigflyin.
Changing my mind, You should use a rotary encoder if possible. Then you could get more accurate settings (ex. index points) because you could see the value on screen. You don't need the pots, but need a rotary encoder:
Please do not use a L298 or L923 to drive a modern bipolar stepper motor. Those are ancient and very inefficient DC motor drivers and are totally inappropriate for driving modern stepper motors despite the plethora of pages that show them driving steppers. Modern bipolar steppers require current control drivers which the L29x drivers are not.
Pololu has a great line of modern stepper drivers. Choose a driver based on the motor supply voltage and coil current limit. I like Pololu because they have good instructional pages for each of their products and their prices are reasonable.
The Encoder library makes using rotary encoders like the KY-040 pretty easy. The Encoder library is available for installation via the IDE library manager.