Jump to content
 

Fun with Arduino - how to get started, and more


RudyB
 Share

Recommended Posts

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.

 

Link to the video.

 

 

34711429bx.jpg

  • Like 6
  • Thanks 1
Link to post
Share on other sites

I shall be most interested in how this thread progresses.  As I see it the Arduino can be used in at least two fundamentally different ways.  The first is to automate operation.  The second is to complete specific tasks, which is my area of interest, specifically a station stop module.  The problem I find is that most of the 'task' videos out there seem to be associated with robotics.  For example, I have not found one that uses an Arduino as a simple potentiometer (PWM stuff for robotics is all over the place but is not suitable for MR loco motors).  Nor have found sketches that use multiple sequential inputs.  

Link to post
Share on other sites

Fun with Arduin 02 Digital Input and Output
 

The second video is online. The plan is to start writing our first code ( 4 lines :) )

 

The goal is to switch the on-board LED on when a push button is pressed.

 

This way we come across commands like pinMode, digitalRead, digitalWrite and we even throw in an if-then-else.

Link to the video.


34731516wf.jpg

  • Like 1
Link to post
Share on other sites

  • RMweb Premium

I have had a dabble with the Arduino but no finished projects yet!

One thing I can't understand is why there are no Arduino periodicals as AFAIK it is more poular being open source, than The Raspberry Pi which is proprietary where there are 6 mags available.

 

I've also got a PCDuino which is a hybrid affair based on the Arduino idea but is a complete microPC running a Linux OS rather than the C++ of the Arduino.

I intend to use it as a JMRI Decoder Pro stand-alone (as long as Java will run on it's version of Linux)

It didn't sell well and is now obsolete.

 

A couple of links you may find useful'

 

On Screen Arduino simulator. This simulates an Arduino graphically on screen

https://sourceforge.net/projects/arduino-simulator-io/

 

MS Visual Studio (Free)

Compiler etc. with Arduino support:

https://visualstudio.microsoft.com/downloads/

 

Keith

Link to post
Share on other sites

Fun with Arduino 03 Connect an External LED and resistor

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

34766252wx.jpg

Edited by RudyB
  • Like 2
Link to post
Share on other sites

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

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()


34815336ne.jpg
 

Edited by RudyB
  • Like 1
Link to post
Share on other sites

Fun with Arduino 05 Connect More LEDs with Relay or FET

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


34829491px.jpg

  • Like 4
Link to post
Share on other sites

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

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


34856405df.jpg

Link to post
Share on other sites

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

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


34878792si.jpg
 

  • Like 1
Link to post
Share on other sites

Fun with Arduino 08 User Interface Serial.print()

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()


34911023ti.jpg
 

  • Like 1
Link to post
Share on other sites

Hi,

 

I find this an interesting topic and I use Arduino clones myself but to avoid confusing people new to this area an Arduino is not a computer - its a microcontroller module or in some cases a microcontroller sub-module.

 

Could this topic be moved to another heading or a new heading created?.

 

 

Regards

 

Nick

 

 

Link to post
Share on other sites

  • RMweb Premium

Hi,

 

I find this an interesting topic and I use Arduino clones myself but to avoid confusing people new to this area an Arduino is not a computer - its a microcontroller module or in some cases a microcontroller sub-module.

 

Could this topic be moved to another heading or a new heading created?.

 

 

Regards

 

Nick

I think most people would consider it all part of "computing" in the wider sense.

 

Keith

  • Agree 1
Link to post
Share on other sites

So DCC would go here as it uses microcontrollers?.

 

Are you implying that this Thread should be moved in with DCC?

 

 I like to control trains with a PC and I use Arduinos as part of that.

 

What harm is it doing to leave this Thread where it is? 

 

What section do YOU think it should go in.

 

 

...R

Link to post
Share on other sites

  • RMweb Premium

Hi,

 

So DCC would go here as it uses microcontrollers?.

 

 

Regards

 

Nick

OK. So when I use my set top box to record a programe it is computing?

My Humax recorder is a complete linux PC controlling the tuner hard, drive, video etc.

What about washing machines? etc.

What's inside DCC could be anything, it doesn't matter to most that use it, it is just a black box.

 

Actually getting into programming a device to do various things is all part of computing, pressing buttons on a handset is not.

 

keith

Edited by melmerby
Link to post
Share on other sites

OK. So when I use my set top box to record a programe it is computing?

My Humax recorder is a complete linux PC controlling the tuner hard, drive, video etc.

What about washing machines? etc.

What's inside DCC could be anything, it doesn't matter to most that use it, it is just a black box.

 

Actually getting into programming a device to do various things is all part of computing, pressing buttons on a handset is not.

 

keith

 

Hi,

 

I was trying to postulate the opposite case - that an Arduino topic should not automatically be part of the computer control topic as the Arduino is just one example of something that can be programmed but is not what most beginners would regard as a computer.

 

For instance this morning I've been programming an Arduino using a laptop. Type Arduino into Wikipedia and it says they are single board microcontrollers and for laptop is says small, portable personal computer.

 

 

Regards

 

Nick

Edited by NIK
Link to post
Share on other sites

  • RMweb Premium

Hi,

 

I was trying to postulate the opposite case - that an Arduino topic should not automatically be part of the computer control topic as the Arduino is just one example of something that can be programmed but is not what most beginners would regard as a computer.

 

For instance this morning I've been programming an Arduino using a laptop. Type Arduino into Wikipedia and it says they are single board microcontrollers and for laptop is says small, portable personal computer.

 

 

Regards

 

Nick

At what point do you think a microcontroller becomes a PC?

e.g. apart from Arduinos I also have a PCDuino.

Meant to do a similar thing with compatible pin-outs etc.

But It also contains it's operating System on board (Ubuntu), a video driver, keyboard driver, etc.

 

It could be used as a complete PC but it was sold as something along the lines of an super-Arduino.

 

Keith

 

EDIT

The Microbit is even more stripped back than an Arduino but is called a programmable computer

Edited by melmerby
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...