Fun with Arduino - a Series of Introductory Videos

Post all your model railway electronic problems, solutions and discoverys here.
User avatar
RudyB
Posts: 188
Joined: Sat Sep 20, 2014 9:29 am

Fun with Arduino - a Series of Introductory Videos

Postby RudyB » Sat Jan 05, 2019 9:46 am

Fun with Arduino - 01 - Getting Started in 6 Easy Steps.

I bet almost everyone here at the forum has heard about the Arduino and how much fun and how useful it can be to model railroaders and to other hobbyists.

Price is no issue at about 3,- £$€. But not every hobbyist has affinity with electronics or with software. To some the initial hurdle can be just too much, even while there may be an interest to get started with Arduno 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 article with video is out: Getting Started in 6 Easy Steps.


Image
Always try to have fun - website/blog - youtube channel

User avatar
PinkNosedPenguin
Posts: 1322
Joined: Tue Oct 01, 2013 10:23 pm
Location: Wiltshire

Re: Fun with Arduino - a Series of Introductory Videos

Postby PinkNosedPenguin » Sat Jan 05, 2019 10:18 am

Many thanks for posting that Rudy.
I would like to try some kind of animation using an Arduino in the near future (I have not purchased anything yet).
Looking forward to the next installment . . . 8)

User avatar
dubdee1000
Posts: 898
Joined: Mon Mar 31, 2008 9:59 pm
Location: cwm brynbuga

Re: Fun with Arduino - a Series of Introductory Videos

Postby dubdee1000 » Sat Jan 05, 2019 11:12 pm

I've spent much of this afternoon nursing a poorly foot but using this time to get started with an Arduino. I've completed the first couple of tutorials and got the thing to blink on and off. I've been using the Dummies book to help me. The pdf that came with the board was ok, but it didn't really teach you anything - you just built the board and that was that. The first project I'm hoping to complete is a third rail sparking effect using some hall sensors and some blue and white LEDs

User avatar
End2end
Posts: 4405
Joined: Sun Jan 12, 2014 9:58 pm
Location: At the end....... and sometimes at the other end

Re: Fun with Arduino - a Series of Introductory Videos

Postby End2end » Sun Jan 06, 2019 12:08 am

Interesting stuff. I watched 1,2 and 3 and look forward to more. :)
I still don't understand OHMs law though. :oops:
Thanks
End2end
"St Blazey's" - The progress and predicaments.
Welcome‎
Planning
Building
St. Blazey's Works & Depot thread

User avatar
PinkNosedPenguin
Posts: 1322
Joined: Tue Oct 01, 2013 10:23 pm
Location: Wiltshire

Re: Fun with Arduino - a Series of Introductory Videos

Postby PinkNosedPenguin » Sun Jan 06, 2019 10:29 am

Oh! Hadn't noticed parts 2 and 3 . . .

@End2end so you didn't do O-level Physics then?
In part 3, Rudy has rearranged the simple Ohm's Law equation to be:
R = V/I (it can also be expressed as V = IR or I = V/R)
to calculate the required resistance to provide the desired voltage and current, converting mA to A. Simples!

User avatar
RudyB
Posts: 188
Joined: Sat Sep 20, 2014 9:29 am

Fun with Arduino 02 Digital Input and Output

Postby RudyB » Sun Jan 06, 2019 10:37 am

In this second video we start writing code ( 4 lines :) )

The goal is to switch the on-board LED on when a push button is pressed. We'll come across commands like pinMode, digitalRead, digitalWrite and we even throw in an if-then-else.

Link to Fun with Arduino 02 Digital Input and Output

Image
Always try to have fun - website/blog - youtube channel

User avatar
RudyB
Posts: 188
Joined: Sat Sep 20, 2014 9:29 am

Fun with Arduino 03 Connect an External LED and resistor

Postby RudyB » Sun Jan 06, 2019 10:39 am

I was running behind with posts ... parts 2 and 3 are here now.

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

Image
Always try to have fun - website/blog - youtube channel

User avatar
dubdee1000
Posts: 898
Joined: Mon Mar 31, 2008 9:59 pm
Location: cwm brynbuga

Re: Fun with Arduino - a Series of Introductory Videos

Postby dubdee1000 » Sun Jan 06, 2019 2:06 pm

Right on time! I'm just about to do this. I want to use a non latching hall sensor to switch on an led, then code it to flash on and off a little, then off before it's triggered again. All being well, the same code can control a number of LEDs spread across the track layout, replicating third rail sparking. I'm using hall sensors so that I can glue a magnet to EMU's/electric locos and they'll trigger it, whereas diesel locos, without the magnets, will not

User avatar
dubdee1000
Posts: 898
Joined: Mon Mar 31, 2008 9:59 pm
Location: cwm brynbuga

Re: Fun with Arduino - a Series of Introductory Videos

Postby dubdee1000 » Sun Jan 06, 2019 5:07 pm

Edit : here we go. I'm new to this so had to Mish mash the code and wiring from a number of sources. Getting g the led to turn as the magnet passed was easy, but I wanted it to flash a couple of times like an arc-ing third rail. If anyone is interested, I'll paste the code here. The first lor of code I used seemed very complicated, what I use now is pretty simple

In action here:

https://youtu.be/ruY6W--0WIw

User avatar
End2end
Posts: 4405
Joined: Sun Jan 12, 2014 9:58 pm
Location: At the end....... and sometimes at the other end

Re: Fun with Arduino - a Series of Introductory Videos

Postby End2end » Sun Jan 06, 2019 11:06 pm

PinkNosedPenguin wrote:@End2end so you didn't do O-level Physics then?
In part 3, Rudy has rearranged the simple Ohm's Law equation to be:
R = V/I (it can also be expressed as V = IR or I = V/R)
to calculate the required resistance to provide the desired voltage and current, converting mA to A. Simples!

O levels were before my time. :lol:
I know the equation off by heart (college sound engineering & electronics course) but I never understood how or where to read / measure the numbers to calculate it. :lol:
Thanks
End2end
"St Blazey's" - The progress and predicaments.
Welcome‎
Planning
Building
St. Blazey's Works & Depot thread

User avatar
RudyB
Posts: 188
Joined: Sat Sep 20, 2014 9:29 am

Fun with Arduino 04 Readable & Maintainable Code , #define, delay()

Postby RudyB » Fri Jan 11, 2019 1:42 pm

The goals in this video are:
- To make our code better readable and easier to maintain.
- We imagine pin 8 operates 20 street lights on a model railway layout. They switch on when we press the button. To simulate a night cycle we want them to stay on for 3 minutes and then automatically switch off again.

Link to Fun with Arduino 04 Readable & Maintainable Code , #define, delay()


Image
Always try to have fun - website/blog - youtube channel

User avatar
RudyB
Posts: 188
Joined: Sat Sep 20, 2014 9:29 am

Fun with Arduino 05 Connect More LEDs with Relay or FET

Postby RudyB » Sun Jan 13, 2019 12:42 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


Image
Always try to have fun - website/blog - youtube channel

User avatar
RudyB
Posts: 188
Joined: Sat Sep 20, 2014 9:29 am

Fun with Arduino 06 Automatic Day & Night Cycle with on/off Switch and LED

Postby RudyB » Thu Jan 17, 2019 12:45 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


Image
Always try to have fun - website/blog - youtube channel

User avatar
dubdee1000
Posts: 898
Joined: Mon Mar 31, 2008 9:59 pm
Location: cwm brynbuga

Re: Fun with Arduino - a Series of Introductory Videos

Postby dubdee1000 » Thu Jan 17, 2019 1:32 pm

Thanks for sharing. I enjoyed that. Looking forward to seeing the next video

User avatar
RudyB
Posts: 188
Joined: Sat Sep 20, 2014 9:29 am

Fun with Arduino 07 Day & Night Cycle, Multiple Light Groups, Random Times

Postby RudyB » Sun Jan 20, 2019 11:22 am

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


Image
Always try to have fun - website/blog - youtube channel


Return to “Electronics”

Who is online

Users browsing this forum: No registered users and 3 guests