Arduino Forum

Using Arduino => Introductory Tutorials => Topic started by: RudyB on Jan 01, 2019, 08:48 pm

Title: Fun with Arduino - a Series of Introductory Videos
Post by: RudyB on Jan 01, 2019, 08:48 pm
Fun with Arduino - Introductory Videos

As a model railway hobbyist I have found the Arduino to be an invaluable tool. It can liven up any layout by making things move, switch lights on and off, and it can even be used as a full fledged DCC decoder.

Not every hobbyist has affinity with electronics or with software however. To some the hill to start can be just too steep, even while there may be an interest to use Arduino and to try things out.

That is where the plan arose to do a series of articles and videos titled 'Fun with Arduino' ... aimed at anyone who is not an IT specialist (yet :) ).

The first two articles, both with video, are out:

Fun with Arduino 01 Getting Started in 6 Easy Steps. (https://rudysarduinoprojects.wordpress.com/2018/12/30/fun-with-arduino-uno-01-getting-started-in-6-easy-steps/)

Fun with Arduino 02 Digital Input and -Output (https://rudysarduinoprojects.wordpress.com/2018/12/31/fun-with-arduino-02-digital-input-and-output/)

Have fun.
Title: Re: Fun with Arduino - a Series of Introductory Videos
Post by: Willpatel_Kendmirez on Jan 04, 2019, 08:52 am
I enjoyed both of those, and wonder what you plan for future episodes?

I'm asking because there is no shortage of Arduino material around the webz. In fact it sometimes seems there's too much, some of it subtly different from others, some of it conflicting and some of it factually incorrect.

Apart from some factual faults like suggesting to power servos from the Arduino 5V, the examples on this site are as good a place as any to start. What's going to make your series different from the others?



Title: Re: Fun with Arduino - a Series of Introductory Videos
Post by: RudyB on Jan 05, 2019, 09:40 am
@Willpatel_Kendmirez
Yes, many articles and video's are already available. Yet at our model railway club I found the hurdle still is steep for many to start, even 'beginner' tutorials tend to go too fast. I intend to intermingle a bit more explanation on hardware and software, hoping that non electronic / IT educated might be able to follow along.

Future subjects will probably focus on examples related to model railway lauouts: lighting (LED and relay / FET), servo (railway crossong), optical sensor (automate the railway crossong), DC or stepper motor to introduce some movement ... things like that.

On Rudy's Arduino Projects blog I'll probaby not promote powering the Arduino directly via a 5V pin, whereas on my Rudys Model Railway blog I do. If 5V is the only available power on the railway layout there's no choice. What is the 'factual faiult' you mention?
Title: Re: Fun with Arduino - a Series of Introductory Videos
Post by: Willpatel_Kendmirez on Jan 05, 2019, 09:59 am
What is the 'factual faiult' you mention?
That one shouldn't power servos from the Arduino 5V as a matter of good practice... ok, maybe not factually incorrect as long as it's a small servo but even micro servos can draw 7-800mA (https://www.addicore.com/Addicore-SG90-Mini-Servo-p/113.htm). Both the servo sweep and knob examples say to do that... as soon as one moves to more than one and / or a bigger servo there's not enough current.

(I didn't say not to power an Arduino into its 5V pin, I said not to power anything substantial out of it.)

I like your idea of making your material "Arduino in a model railway world": that makes perfect sense for your audience, who do not want to get bogged down in the arcana of electrical engineering, but do want to get their model railways to work safely and reliably without too much fannying about.

Coincidentally, Robin2 had this to say to me yesterday:

I use them [nRF24L01's] for radio control for model trains. I have made some units for my model railway club that take the place of wired controllers so folk aren't tripping over the wires. And I have some installed in my own trains for battery powered radio control.

Title: Fun with Arduino 03 Connect an External LED and resistor
Post by: RudyB on Jan 06, 2019, 12:04 pm

The third video is online.

To control the on board LED is fun, but the real fun only starts when we can control external LEDs, like on a switch panel, or on a model railway layout. This video is about how to connect a LED and how to choose the value of the series resister we need to set the LED brightness.

In the next video we are going to control the external LED and we will simulate a night cycle on a model layout.

Link to Fun with Arduino 03 External LED and Resistor (https://rudysarduinoprojects.wordpress.com/2019/01/04/fun-with-arduino-03-connect-an-external-led/)

(https://up.picr.de/34766252wx.jpg)
Title: Fun with Arduino 04 Readable & Maintainable Code , #define, delay()
Post by: RudyB on Jan 11, 2019, 02:32 pm


The goals in this video are:

Link to Fun with Arduino 04 Readable & Maintainable Code , #define, delay() (https://rudysarduinoprojects.wordpress.com/2019/01/11/fun-with-arduino-04-readable-and-maintainable-code-with-define/)



(https://up.picr.de/34815262tn.jpg)
Title: Fun with Arduino 05 Connect More LEDs with Relay or FET
Post by: RudyB on Jan 13, 2019, 01:35 pm

Arduino outputs can only switch 20mA. If we want to control groups of multuple lights on our model railway layout, we will need some more 'oompf'. A 12V power supply will do great and we can use Relay or FET modules, controlled by the Arduino, to swicth the higher current / voltage. How to do this, how to wire this, is the subject of this video and article.


Link to Fun with Arduino 05 Connect multiple LEDs with a Relay or a FET (https://rudysarduinoprojects.wordpress.com/2019/01/13/fun-with-arduino-05-connect-multiple-leds-with-a-relay-or-a-fet/)


(https://up.picr.de/34829491px.jpg)
Title: Fun with Arduino 06 Automatic Day & Night Cycle with on/off Switch and LED
Post by: RudyB on Jan 17, 2019, 01:41 pm

In this 6th video we are going to create a fully automatic day / night sequence, witch a toggle switch and an indicator LED on our switch panel. The day & night times are going to be configurable in seconds, which means we need some math to go to milliseconds.

Link to Fun with Arduino 06 Automatic Day & Night Cycle with on/off Switch (https://rudysarduinoprojects.wordpress.com/2019/01/17/fun-with-arduino-06-automatic-day-night-cycle-with-on-off-switch/)


(https://up.picr.de/34856405df.jpg)
Title: Fun with Arduino 07 Day & Night Cycle, Multiple Light Groups, Random Times
Post by: RudyB on Jan 20, 2019, 12:18 pm

Our day / night module of the previous video works perfect, but it controls just one light group. On our layout we probably have multiple groups ... houses, street lights, a railway station or an industry area. In this video we're going to see how we can control multiple light groups in a day / night cycle, while of course they do not switch all at the same time and also while making it non predictable.

Link to Fun with Arduino 07 Day & Night Cycle, Multiple Light Groups, Random Times (https://rudysarduinoprojects.wordpress.com/2019/01/19/fun-with-arduino-07-day-night-cycle-multiple-light-groups-random-times/)


(https://up.picr.de/34878792si.jpg)
Title: Fun with Arduino 08 User Interface Serial.print()
Post by: RudyB on Jan 24, 2019, 04:34 pm

Our way of modifying the day / night cycle time seemed quite handy, but we do need to modify the code and upload it again every time we like to change the cycle time. Is there maybe an easier way?

Yes there is ... we can change the cycle time 'on the fly' via a User Interface. There are different solutions, with hardware otr with software. We're going to try them both. In this video we'll do the first preparations, writing text and numbers to the PC screen via Serial.print().

Link to Fun with Arduino 08 User Interface Serial.print() (https://rudysarduinoprojects.wordpress.com/2019/01/24/fun-with-arduino-08-user-interface-serial-print/)


(https://up.picr.de/34911023ti.jpg)
Title: Fun with Arduino 09 Variables byte int long unsigned
Post by: RudyB on Jan 27, 2019, 10:47 am

Before we continue to work on our User Interface, let's first take a moment to have a closer look at variables and data types. We are going to use ever more variables in the coming videos ... and ... we'll have a look at a pitfall concerning data types that prevented our code from previous video 8 to always work as intended.

Fun with Arduino 09 Variables byte int long unsigned (https://rudysarduinoprojects.wordpress.com/2019/01/25/fun-with-arduino-09-variables-byte-int-long-unsigned/)


(https://up.picr.de/34932647jl.jpg)
Title: Re: Fun with Arduino - a Series of Introductory Videos
Post by: Robin2 on Jan 27, 2019, 11:30 am
It is not a good idea to use the String (capital S) class on an Arduino as it can cause memory corruption in the small memory on an Arduino. This can happen after the program has been running perfectly for some time. Just use cstrings (http://www.cplusplus.com/reference/cstring/) - char arrays terminated with '\0' (NULL).

...R
Title: Fun with Arduino 10 Show Cycle Status and Time with Serial.print
Post by: RudyB on Jan 31, 2019, 03:08 pm

Now that we have our code working, by using the correct data type or by typecasting, we can continue the work on our User interface. The goal in this video is to display the status of our day / night cycle on screen ... is it switched on or off, is it day or night, and what is the currently used day / night time. All this will be dynamically updated.

Fun with Arduino 10 Show Cycle Status and Time with Serial.print (https://rudysarduinoprojects.wordpress.com/2019/01/31/fun-with-arduino-10-show-the-day-night-cycle-status-on-the-user-interface/)


(https://up.picr.de/34964832sg.jpg)
Title: Fun with Arduino 11 Keyboard Input via Serial Read and ParseInt
Post by: RudyB on Feb 03, 2019, 09:39 am

The User Interface works, it shows us the status if the day / night cycle on screen. We're now going to add the option to change the cycle time via the keyboard. The functions we are going to use are Serial.available(), which tells us that there is new input, and Serial.read() or Serial.parseInt() to read the characters that are typed.

Fun with Arduino 11 Keyboard Input via Serial Read and ParseInt (https://rudysarduinoprojects.wordpress.com/2019/02/03/fun-with-arduino-11-data-input-via-keyboard-serial-read-serial-parseint/)


(https://up.picr.de/34986161sw.jpg)
Title: Fun with Arduino 12 Analog Input, analogRead(), Change Range, map()
Post by: RudyB on Feb 07, 2019, 11:35 am

Now that we can change the cycle time via the PC keyboard, let's have a look at a hardware oriented solution ... a rotating knob. We connect a potentiometer to an analog input and read the voltage with the analogRead() instruction. With the map() instruction we can convert the range from 0-1023 to the range that we like to use for our cycle time, like say 1-9 minutes with a 1 minute step size, or maybe 10-300 seconds, with a 10 second step size.

Fun with Arduino 12 Analog Input, analogRead(), Change Range, map() (https://rudysarduinoprojects.wordpress.com/2019/02/07/fun-with-arduino-12-analog-input-analogread-change-range-map/)


(https://up.picr.de/35016651zo.jpg)
Title: Fun with Arduino 13 Timer with millis(), no delay(), Multitasking
Post by: RudyB on Feb 10, 2019, 10:31 am

The delay() statement that we used so far for our timing stalls the Arduino. This leads to a complete lack of feedback when we change the cycle time while the cycle is running. Luckily there is a solution: we can use the Arduino internal clock, which counts milliseconds from the moment the Arduino is started. We can read the clock using the millis() statement and we can decide if it is time for action.

Fun with Arduino 13 Timer with millis(), no delay(), Multitasking (https://rudysarduinoprojects.wordpress.com/2019/02/10/fun-with-arduino-13-timer-with-millis-no-delay-multitasking/)


(https://up.picr.de/35036320hc.jpg)
Title: Fun with Arduino 14 Day Night Cycle with millis(), no Delay, Direct Feedback
Post by: RudyB on Feb 14, 2019, 10:44 am

Now that we know how to get rid of the delay(0 and use millis() in stead (video 13) we can finalize our Automatic Day Night Light Cycle unit to have direct on screen feedback of cycle time adjustment by the user and to have the cycle stop, and the lights turn off, immediately when the switch is set to 'off'.

Our unit has quite nice specifications:
- Configurable timing, via keyboard or via analog input with on screen display
-  An option to randomize the times to give it some 'livelyness'
- On screen display of the on/off, day/night state and the cycles times


Fun with Arduino 14 Day Night Cycle with millis(), no Delay, Direct Feedback (https://rudysarduinoprojects.wordpress.com/2019/02/10/fun-with-arduino-14-day-night-cycle-with-millis-no-delay/)


(https://up.picr.de/35064128sm.jpg)
Title: Fun with Arduino 15 LED Dimmer, analogWrite(), Pulse Width Modulation
Post by: RudyB on Feb 17, 2019, 10:52 am

We used analogRead() to read the voltage on our potentiometer. The Arduino also has the opposite instruction: analogWrite(). This name is somewhat misleading. Unlike with an analog input, where a 10 bit A/D converter is used, the Arduino does not have a D/A converter on board.

The analogWrite() function uses a technique called Pulse Width Modulation. A digital output switches between HIGH and LOW in a fast pace, whereby the HIGH percentage is proportional to the analog value we wish to send out. If a device that receives the signal is too slow to follow the switching frequency, the result is it 'sees' the average of the on/off times. This also holds for light ... even though LEDs are fast enough to follow the switch frequency, our human eyes + brain are not and we see an average brightness.


Fun with Arduino 15 LED Dimmer, analogWrite(), Pulse Width Modulation (https://rudysarduinoprojects.wordpress.com/2019/02/17/fun-with-arduino-15-led-dimmer-with-pulse-width-modulation-analogwrite/)


(https://up.picr.de/35088670bd.jpg)
Title: Fun with Arduino 16 LED Dimming with Fade, analogWrite(), millis()
Post by: RudyB on Feb 21, 2019, 12:06 pm
Fun with Arduino 16 LED Dimming with Fade, analogWrite(), millis()

Now that we know how to dim LEDs with analoWrite(), we can go a step further and change the dimming over time to create a gradual fade in or out. This is a nice effect for instance for LED strips mounted under kitchen cabinets, or for LED strip overhead lighting on a model railway layout to simulate a gradual change from night to day. And also for the red/green transition of railway signals along the track a fade gives just that little extra eye candy.

Fun with Arduino 16 LED Dimming with Fade, analogWrite(), millis() (https://rudysarduinoprojects.wordpress.com/2019/02/21/fun-with-arduino-16-led-strip-fading/)


(https://up.picr.de/35120672uf.jpg)
Title: Fun with Arduino 17 Railway Crossing, State Transition Diagram, switch()
Post by: RudyB on Feb 25, 2019, 10:38 am

We're at the start of a new Arduino project: an automatic railway crossing.

The system comprises several parts: train detection (optical), blinking lights ('blink' with a twist), a moving beam (servo motor).

We'll look into a way of specifying these kinds of systems as well as a way to translate the specifications into code, with a stepwise approach that does not put too much strain on our grey cells.


Fun with Arduino 17 Railway Crossing, State Transition Diagram, switch() (https://rudysarduinoprojects.wordpress.com/2019/02/22/fun-with-arduino-17-railway-crossing-state-transition-diagram-switch-case/)


(https://up.picr.de/35150263is.jpg)
Title: Fun with Arduino 18 Railway Crossing, Servo Motor to Operate the Gate
Post by: RudyB on Feb 28, 2019, 10:50 am

In part 2 of the railway crossing project we are going to connect the servo motor that operates the gate and control it with the Arduino. With the example in the video, the gate beam is mounted directly on the servo. On a layout, the servo motor will probably be mounted under the board, and a metal rod pulls / pushes the beam up and down, through a hole. No matter how it is mounted ... we need to find the correct servo angles. We will write some code with which we can fine tune the servo to find the angles to be used in the code later on. 


Fun with Arduino 18 Railway Crossing, Servo Motor to Operate the Gate (https://rudysarduinoprojects.wordpress.com/2019/02/23/fun-with-arduino-18-railway-crossing-servo-motor-to-operate-the-gate/)


(https://up.picr.de/35173980gt.jpg)
Title: Fun with Arduino 19 Railway Crossing Train Detection with Optical Sensor
Post by: RudyB on Mar 07, 2019, 11:31 am

There are several ways to do train detection, like sensing rail current, or a magnet under the train that triggers reed switches along the track, or with an optical sensor. The latter is used in this video, only because I had some TRCT5000's lying around and they were easy to setup for a demo. As soon as we have them working, we have some fun with them by making a train speed measurement device.


Fun with Arduino 19 Railway Crossing Train Detection with Optical Sensor (https://rudysarduinoprojects.wordpress.com/2019/03/07/fun-with-arduino-19-railway-crossing-train-detection-optical-sensor/)


(https://up.picr.de/35224667gx.jpg)
Title: Fun with Arduino 20 Railway Crossing Putting it all Together
Post by: RudyB on Mar 10, 2019, 12:12 pm

We have seen the separate ingredients for a level crossing in the previous three videos: blinking LEDs, servo to operate the gate, sensors to detect the train ... it is time to put it all together now into one piece of software. We'll use the State Transition Diagram as our starting point and build up the software in 5 easy to follow steps.


Fun with Arduino 20 Railway Crossing Putting it all Together (https://rudysarduinoprojects.wordpress.com/2019/03/10/fun-with-arduino-20-railway-crossing-part-4-putting-it-all-together/)

Railway Crossing UK version (https://rudysarduinoprojects.wordpress.com/2019/03/10/fun-with-arduino-21-railway-crossing-uk/)


(https://up.picr.de/35246191mm.jpg)
Title: Fun with Arduino 22 Step Sequencer for LEDs with array[] and for() loop
Post by: RudyB on Mar 14, 2019, 03:20 pm

A police car, fire fighter car or an ambulance with flashing lights can liven up any model railway laout. The challenge that we set ourselves is not to have to write different code any time we want another flashing pattern. We want to hav one and the same code and we only want to configure the number of stepd, number of LEDs and the flashing step sequence. Can we manage that? Yes of course we can ...


Fun with Arduino 22 Step Sequencer for LEDs (https://rudysarduinoprojects.wordpress.com/2019/03/14/fun-with-arduino-22-flashlights-with-a-step-sequencer-array-for-loop/)


(https://up.picr.de/35275550sn.jpg)
Title: Fun with Arduino 23 Neopixel Addressable LED, WS2812, struct{...}
Post by: RudyB on Mar 21, 2019, 03:02 pm

Neopixels, or addressable LEDs, are color LEDs with a built in chip that takes care of the one wire data communication and of the Pulse Width Modulation for the built in RGB(+W) LEDs. The LEDs are connected via just 3 wires, GND, 5V, Data. The Data line is connected to an Arduino output and we can control the color and brightness of multiple LEDs, via just one output. Wonderful to use in say a village with multiple houses on our model railway layout. The wiring is super simple and the lights in every house switch independently and can each have their own color an brightnes ... just like real.


Link to Fun with Arduino 23 Neopixel Addressable LED, WS2812, struct{...} (https://rudysarduinoprojects.wordpress.com/2019/03/21/fun-with-arduino-23-neopixel-addressable-leds-with-ws2812-ic/)


(https://up.picr.de/35325786gn.jpg)
Title: Fun with Arduino 24 Neopixel Sequencer with Flexible Timing and Colors
Post by: RudyB on Mar 29, 2019, 12:07 pm

In video 23 we made a step sequencer for addressable LEDs (Neopixel). The beauty of it is that a LED on/off sequence is created in a visual way by editing a series of '1's and '0's: 1,1,1,0,0,0,1,1,0,0,1,0,1,1,0,0. The drawback being that the color of every LED is fixed and also the interval time is fixed. The sequencer in this video has full flexibility, every action step has its own timing and LED color / brightness.


Link to Fun with Arduino 24 Neopixel Sequencer with Flexible Timing and Colors (https://rudysarduinoprojects.wordpress.com/2019/03/29/fun-with-arduino-24-neopixel-sequencer-with-flexible-timing-and-colors/)


(https://up.picr.de/35387660po.jpg)
Title: Fun with Arduino 25 Rotary Encoder with Switch
Post by: RudyB on Apr 05, 2019, 02:41 pm

A rotary encoder is a digital device, approximately the size of an analog potentiometer. When rotated, it generates 2 pulse signals from which we can deduct the number of rotation steps and the direction of rotation. It also has a push button on board. When connected to the Arduino we can read out the encoder and change the value of a variable. The variable can be used for anything we like: control the brightness of a LED(strep), control the angle of a servo motor, and more.

In this video we build the software to read out the encoder and switch and control the brightness of a LED (via PWM). In the next video we are going to beuild a servo tune application based on it.


Fun with Arduino 25 Rotary Encoder with Switch (https://rudysarduinoprojects.wordpress.com/2019/04/05/fun-with-arduino-25-rotary-encoder-with-switch/)


(https://up.picr.de/35440500dh.jpg)
Title: Fun with Arduino 26 Tune a Servo with a Rotary Encoder
Post by: RudyB on Apr 11, 2019, 11:28 am

In the previous video we wrote code to read out the pulses and the switch of a rotary encoder. We are now going to use this to tune a servo motor.

With every mechanical construction where a servo is used to move something (garage doors, a gate beam, a turnout), the minimum and maximum servo angles need to be found for the construction to operate like we want it to. In this video we are going to build a 'servo tuner' to find those angles.

Fun with Arduino 26 Tune a Servo with a Rotary Encoder (https://rudysarduinoprojects.wordpress.com/2019/04/11/fun-with-arduino-26-tune-a-servo-with-a-rotary-encoder/)


(https://up.picr.de/35486094lg.jpg)
Title: Fun with Arduino 27 Recognize Slow / Fast Rotation of Rotary Encoder
Post by: RudyB on Apr 18, 2019, 11:00 am

The Servo Tuner that we built in the previous video can be enhanced with two features:
1: Recognition of slow or fast rotation of the rotary encoder, to be able to increment the motor with small steps or with larger steps.
2: Recognition of short or long press of the button, to be able to move to the min/max angles or to the midpoint of the servo.
In this video we will have a look how we can add these functions.

On the blog there's also code available to operate the Servo Tuner with a wire or with push buttons, in case you don't have a rotary encoder available.

Fun with Arduino 27 Rotary Encoder Slow / Fast Recognition (https://rudysarduinoprojects.wordpress.com/2019/04/18/fun-with-arduino-27-rotary-encoder-recognize-slow-or-fast-rotation/)


(https://up.picr.de/35540935gm.jpg)
Title: Fun with Arduino 28 Use an External Editor like Notepad++
Post by: RudyB on Apr 25, 2019, 11:46 am

When writing more code than just a few lines, it might be worthwhile to invest a little bit of time to to start using a more capable editor than the one integrated in the Arduino IDE. There are several free editors around that have a wealth of features that make code editing more efficient and more pleasurable.

Link to Fun with Arduino 28 Use an External Editor like Notepad++ (https://rudysarduinoprojects.wordpress.com/2019/04/25/fun-with-arduino-28-use-an-external-editor-like-notepad/)


(https://up.picr.de/35602399oy.jpg)
Title: Fun with Arduino 29 DCC Accessory Decoder
Post by: RudyB on May 06, 2019, 12:21 pm

With the aid of very little extra hardware we can use Arduino as a DCC decoder, with a price tag that is almost 10x lower than commercially available decoders. In this video we create a DCC Accessory Decoder. In the next video we'll make a DCC Servo Decoder.

In stead of DIY, alternatively you can use the ARCOMORA software (https://www.arcomora.com/), which is fully configurable via a user interface.


Link to Fun with Arduino 29 DCC Accessory Decoder (https://rudysarduinoprojects.wordpress.com/2019/05/06/fun-with-arduino-29-dcc-accessory-decoder/)


(https://up.picr.de/35692729rd.jpg)
Title: Fun with Arduino 30 DCC Servo Decoder
Post by: RudyB on May 13, 2019, 12:01 pm

Based on the code for the DCC Accessory Decoder we can create a Servo Decoder. All we have to do is add a couple lines of code to toggle the setpoint of the servo, based on the DCC status, and add the code to rotate the servos based on a millis() timer.

Link to Fun with Arduino 30 DCC Servo Decoder (https://rudysarduinoprojects.wordpress.com/2019/05/13/fun-with-arduino-30-dcc-servo-decoder/)


(https://up.picr.de/35744851vf.jpg)
Title: Fun with Arduino 31 Stepper Motor with 4 Pulse Driver
Post by: RudyB on May 23, 2019, 12:32 pm

With some applications a stepper motor is prefered over a servo. For instance for the continuous rotation of say a wind mill model. Or with applications like a turn table, a linear shift table or an elevator, a stepper motor can be of great help thanks to the accurate positioning that is possible.

In this video we connect a very cheap (less than $2,-) toy motor to our Arduino and run it. In the coming videos we'll look at features like change directon, speed control and accurate positioning, and we'll look at more powerful motors and drivers.

Link to Fun with Arduino 31 Stepper Motor with 4 Pulse Driver (https://rudysarduinoprojects.wordpress.com/2019/05/23/fun-with-arduino-31-stepper-motor-with-4-input-driver-using-a-function/)


(https://up.picr.de/35817901ro.jpg)
Title: Fun with Arduino 32 Stepper Motor Change Direction and Control Speed
Post by: RudyB on May 31, 2019, 11:32 am

In the previous video we made the stepper motor run. In this video we'll add 2 functions: change direction and control speed.


Link to Fun with Arduino 32 Stepper Motor Change Direction and Control Speed (https://rudysarduinoprojects.wordpress.com/2019/05/31/fun-with-arduino-32-stepper-motor-change-direction-and-control-speed/)


(https://up.picr.de/35883789dh.jpg)
Title: Fun with Arduino 33 Find Zero Switch or Sensor
Post by: RudyB on Jun 06, 2019, 11:15 am

A stepper motor does not know where it is after power up. If we want to use a stepper for accurate positioning, we first have to define its 'zero' point. This can be done by slowly rotating the motor until a sensor or a micro switch is activated.

In this video we'll add a zero find routine as a preparation to the following vodeo where we will accurately position the motor. The video after that we will build a complete turn table control.

Link to Fun with Arduino 33 Find Zero Switch or Sensor (https://rudysarduinoprojects.wordpress.com/2019/06/06/fun-with-arduino-33-stepper-motor-control-find-zero-switch-or-sensor/)


(https://up.picr.de/35934058ez.jpg)
Title: Fun with Arduino 34 Rotate an Exact Number of Steps
Post by: RudyB on Jun 13, 2019, 11:52 am

Now that we can find the zero switch or -sensor, we can start to position our application by rotating the motor an exact number of steps. No matter if the motor has to make 97 steps or maybe 144668 ... as long as the motor torque and the driver electronics voltage and current suffice in order to not lose steps on the way, we can position the motor with 1 step accuracy.

Fun with Arduino 34 Rotate an Exact Number of Steps (https://rudysarduinoprojects.wordpress.com/2019/06/13/fun-with-arduino-34-stepper-motor-control-rotate-exact-amount-of-steps/)


(https://up.picr.de/36001225fw.jpg)
Title: Fun with Arduino 35 Turn Table Control with a Stepper Motor
Post by: RudyB on Jun 17, 2019, 01:03 pm

Now that we can find the zero switch or -sensor, and we know how to position our application by rotating an exact number of steps, we have all ingredients to build say a turn table, or a translating table or an elevator.

We use a Tuning sketch to determine the number of steps for every stop position, counting from the zero position. The numbers are entered into the Turntable Control sketch. Digital inputs are used to tell the Arduino to which position we want to move. 

Link to Fun with Arduino 35 Turn Table Control with a Stepper Motor (https://rudysarduinoprojects.wordpress.com/2019/06/17/fun-with-arduino-35-turn-table-control-with-stepper-motor/)


(https://up.picr.de/36033228kx.jpg)