Neil Erickson NeilEr

The Arduino is an open source hardware and software hobbyist platform that has huge grass roots support here on MRH and worldwide. It has such huge potential at a reasonable price that I couldn't stop thinking about how to implement or exploit this on my layout. Peter in NZ has encouraged me to get going with this and so, successes (I hope) or failures will be posted here along with links to other sites of interest. Please follow along and feel free to post thoughts, experiences, and links of interest. 

Goeff Bunza has opened the door to the Arduino as a decoder and now the a stand alone DCC base station and throttle programs (called "sketches" in Auduino speak) are available along with "shields" (similar to daughter boards in computer use) to allow motor control, wireless communication and much much more. 

Thanks for looking.  

Neil E

Neil Erickson, Hawai’i 

My Blogs

Reply 0
Neil Erickson NeilEr

First off

With some trepidation I received the response from Peter (reprinted with his permission) to my inquiry about "jumping in":

Good on you.  Jump in the water is fine.  I started with Arduino as a complete noob not that long ago.  Like you my start was triggered by Geoff's posts.

On the presumption that your Uno came with a USB cable, I would start by doing the following:

1.  Download and Install the Arduino IDE from here  https://www.arduino.cc/en/Main/Software

2. Keep a note of the Version number and if you install it on any other devices make sure you use the same Version #.

3.  If the installation process hasn't already done this, in your documents library create a new folder called Arduino then in the Arduino folder create a sub folder called Libraries.  This (Libraries sub folder) is where you should save and store all of your sketches.  Any Libraries that you import (such as Geoff's various examples) should also go here.

4.  Start up the Arduino IDE and from the Tools Menu click on Board and then click on Arduino Uno.  This tells the IDE what sort of board you are using.  A vital step and one to check if you ever have problems with sketches not loading or running.  It only needs to be changed if you use a different type of board.

5.  Plug  your board into a spare USB port on your computer and then open up Device manager, click on Ports (Com and LPT) and see if you can identify which Com Port the Uno has decided to use.   You can only do this step with the board plugged in.

6.  Go back to the IDE and from the Tools Menu click on Port and make sure that the correct Com Port is selected.  This is the second Vital step and if it is wrong nothing will work. 

This port selection process varies a bit with different boards and can be one of the biggest sources of frustration.  Just remember that Google is your friend.  If that fails either post back here or PM me.

7.  From the File Menu click on Examples, then on 01.Basics and then on Blink.  This should bring up and example Sketch (program) called Blink in a separate window.

8.  Roll your mouse over the Tick mark in the menu bar and the word Verify should appear. Click the Tick box and you will se a message and a progress bar down the bottom.  If all is good you will get a message saying "Done Compiling".  This is my 3rd Vital step.  If the sketch won't compile then there is a problem in the code that needs to be resolved. 

9.  Just to the right of the Tick box is a Right Arrow Box.  Hover your mouse over that and you should see the word "Upload" appear.  Click on the box and again you should get a message saying "Uploading" and a progress bar.  As the Progress bar gets towards the end, a couple of lights should start blinking furiously on your UNO (this shows the sketch is being loaded onto the board). When that flurry of activity dies down, a single LED on your UNO should start blinking on and off at a rate of 1 blink per second.

10.  Have a look at the sketch and find the 2 lines that have a "delay" command in them.  Try changing the value (default is 1000 milliseconds) to say 5000.  Verify the sketch, upload it again and see what happens.

Blink is a very useful tool for checking that any new board is working as it should.  I always upload this to a new board before trying to upload anything else.

The other Example sketches are a great way of learning how this whole thing works and what is available.  All of these sketches are very well documented..  Comments can either have "// "preceding them or for multiple lines they may have a "*/" at the beginning and a "/* "at the end.

If this works out maybe we should start a separate blog.

Let me know how you get on.

 

Peter Modelling CSX in HO

Quote:
Thank you Peter!
Quote:
Neil

Neil Erickson, Hawai’i 

My Blogs

Reply 0
pierre52

Arduino IDE

Another quick tip.  Arduino offers two download options for Windows users: "Windows Zip File" or "Windows Installer".

Unless you are admin on a network, I would recommend the Windows Installer option.

 

Mac and LINUX I think are self explanatory.

Peter

The Redwood Sub

Reply 0
RandallG

I would recommend the Windows

Quote:

I would recommend the Windows Installer option

What is the reason for this?

Randy

Reply 0
Neil Erickson NeilEr

From Noob to newb

After following Peters directions I downloaded the IDE (whatever that means) and starting the software I was able to easily find exactly what he said and chose my "Uno" and select the correct port - in my case the USB (actually said it was connected to the Arduino Uno. I use an older MacBook Pro at home with a wifi connection via Verizon Wireless (they call this a mifi). 

After messing with the example "blink" I could change the time the led is on or off so started looking at the online help for other things to try. Amazing resources out there so will dig out some parts I've collected and see what else is possible. 

While online I searched IDE because I was sure it wasn't "Idiot Doing Experiments" but something more reasonable. While in the Urban Dictionary it seems I have been a noob but becoming more of a newb - newbie. Just ignorant and not an idiot anymore.  http://www.urbandictionary.com/define.php?term=Noob

Onward!

Neil

Neil Erickson, Hawai’i 

My Blogs

Reply 0
pierre52

Laugh out Loud

Just goes to show that I am officially no longer "with it".  Apologies Neil for inadvertently accusing you of "no longer having the will to learn".   I had thought the two terms wer interchangeable - sure pays to check.  I hope no offence was taken.

@ Randy

The Installer version is a straight forward executable file. Just what you would expect on any program download.

The other version is way more complicated.

Peter

The Redwood Sub

Reply 0
RandallG

That's great Peter. Simple

That's great Peter. Simple sounds nice.

Randy

Reply 0
Neil Erickson NeilEr

Next

@Peter - No worries brah. I thought the same thing. 

I would like to test the other examples but not sure about simply plugging in an led or potentiometer. How is this done? 

Neil

Neil Erickson, Hawai’i 

My Blogs

Reply 0
pierre52

Time to break bread

Neil

At this point I would suggest that you need to start using a breadboard.  You can plug things straight into the UNO but I would suggest that a Breadboard and a bag of Wire connectors  such as this one ($4.95 on Ebay):

eadboard.jpg 

would make life a lot simpler. Components like LEDs, Resistors and Pots can be plugged directly into the board and the the cables can be used to link back to the appropriate pin on your UNO.  There is a +ve and -ve bus on either side of the board.  Use the -ve bus as a Ground  connection for both components and the GND pin on your UNO.  Use the +ve Bus where you need to supply DC  power.  I would say 5V DC is the best voltage to work with when using Arduino. If you can find a 5 volt DC wall wart at about 1 amp that would be perfect.  Otherwise if you have a 12V DC supply you can reduce it to 5V with one of these:

M%20055L.jpg 

http://www.ebay.com/itm/KIM-055L-DC-DC-12V-9-35V-to-5V-5A-Step-Down-Power-Converter-Module-/262136733925?hash=item3d089120e5:g:tC0AAOSwsFpWS9k7

 

 

Peter

The Redwood Sub

Reply 0
Pelsea

Put your breadboard on a breadboard--

Like this:

eadboard.jpg 

There are two things to watch for when prototyping Ardunio circuits-

  • The bottom of the Arduino can easily short on junk on the workbench.
  • Movement of the breadboard relative to the Arduino makes for flaky connections.

If you nail both to a piece of plastic or wood, those problems go away. I have quite a collection of boards set up this way.

pqe

Reply 0
George Sinos gsinos

Good Book

There are a bunch of Arduino books out there. Most are just rehashes of the built-in tutorials.  And there are a lot of kits that bundle the parts you need for the basic experiments. Amazon has several from different suppliers.

I'm using this book to work with my grandson. It has the basics, plus quite a bit of introductory electronics theory that goes beyond the "plug this part in here" nature of most of the books. It also has some projects that seem to go beyond some of the other books.  

Don't overlook the free tutorials at Adafruit.com and Arduino.cc.  And don't forget to have fun.

gs

 

Reply 0
Neil Erickson NeilEr

The stuff

Thank you all. I have been collecting stuff for a long time knowing that one day my fear of flying in this realm would diminish. There are so many online videos and tutorials that reading and watching these is a hobby in itself. So out came the stuff:

age(68).jpeg 

The packages starting on the upper left are part of the Sparkfun Kit called the Danger Shield. All the rest came from an experimenters toolkit (Radio Shack?). A friend retired and closed his electronics repair shop and gave me several bags of other stuff that, honestly, I really don't know what many of the parts are. I figure this is a start. 

Neil

Neil Erickson, Hawai’i 

My Blogs

Reply 0
Jim at BSME

Shortcut & USB->serial

Just wanted to point out a simple shortcut, if you click the upload button and the sketch has not been compiled, the Arduino IDE (Integrated Development Environment), will compile it and if the compile is successful upload to your board.

You may not have to look into your device manager to determine the com port number that the Arduino is at, just click on Port under the Board and if you only have one choice, it should be the Arduino.

Also I just got some of the Chinese produced UNO boards and had to search for the USB-> serial driver, found the one here to work: http://www.driverscape.com/download/usb-serial-ch340

I didn't use the installer version, but just selected the driver appropriate to my OS, unzipped it to the Arduino\drivers folder and then used the found new hardware wizard and told it to look for the driver in a specific location.  If you have already hooked up the Arduino you will need to use the Device Manager to install the driver.

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: FacebookInstagram
Reply 0
Neil Erickson NeilEr

Good fun

Building little projects to test has been a lifelong goal and this has made doing so such fun. I did get the Arduino up and running as well as build the DangerShield from Sparkfun. Learning to code (been 40 years!) has been taking up all my modeling time but this is so much fun to explore that I may have to re-examine my multitude of kits accumulated :-( 

The examples on Arduino.cc , here, and on AdaFruit, and SparkFun have been a big help with syntax for the Sketches. I think this is a rudimentary C language but follows a lot of the rules I remember. I see the opportunity to trigger events with a variety of inputs so my mind is constantly going over ideas. Today I ordered some more components off eBay to play with. One, a analog volt meter, could be re-purposed to display air pressure or, in my case, steam pressure in a boiler. The deeper the "notch" chosen would quickly use all the steam pressure so must be used judiciously when starting a heavy train or when on a hill so as not to run out before reaching a summit!

Other ideas are brewing such as a guitar selector switch to simulate a Johnson bar. Not just forward and reverse but to provide greater torque (more steam in the cylinder, deeper and more pronounced chuff). For DCC this could also trigger speed tables and momentum effects. I know very little about back EMF but, I hope, the feedback to the throttle would create the need for more steam on uphill grades and less downhill - even requiring braking. Of course the sound component would be reflected when drifting, braking, or working the hill. (Notching would be a manual approximation of mass to be pulled similar to setting the momentum.)

Other ideas include braking and setting a brake at rest. This would become important when on an incline as the engine could simply begin to coast downhill! Steam engines working a yard are surprisingly quiet when running light so the forward/reverse in a single notch may also stifle the audible "chuff".

Clearly my 2 hour drive (each way) to our other office has given me too much time to think. Please let me know what you would include in a steam backhead and handheld throttle. 

Neil

btw - I am thinking fake rivets around the throttle enclosure similar to Tim and Rick's facia - crazy?

Neil Erickson, Hawai’i 

My Blogs

Reply 0
Pelsea

About those Chinese boards

The Arduino project is an academic endeavor, which means the professors involved have the blessings of their school but no actual monetary support. This means development costs are recovered from the sale of boards or licenses to make boards. Unfortunately, the system has proved so popular that counterfeiters have taken over a big chunk of the market. This has two down sides- counterfeit boards may not prove reliable (or even work), and development of new boards, or just keeping the IDE* working through the convulsions of Windows 10 upgrades is in real danger. Please get your Arduino or Genuino (EU license) boards from reputable suppliers and avoid counterfeits

Here are some parts of the story.

pqe

That's Integrated Development Environment, for the person who asked.

Reply 0
Jim at BSME

Counterfeits vs Open Source

The UNO boards made in China are only counterfeits if they have all the Arduino markings, since the UNO is open-source hardware anyone can download the eagle PCB files, the schematics, even the board dimension files at: https://www.arduino.cc/en/main/arduinoBoardUno, scroll down to documentation, and make their own Arduino including all the manufactures in China.

I don't see the connection between the story and the counterfeits.  The story is about how one of the Italian partners, the one who produced the majority of the boards, trade marked the name Arduino in Italy while the others were busy trade marking the name in the US.

What I find interesting is they ask you to contribute when you download the IDE, but they don't seem to have a link anywhere else to contribute, but you can go back to the download page and download again.

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: FacebookInstagram
Reply 0
Jim at BSME

Arduino Language

The programming language is C/C++, the compiler does some work for you, so you don't have to do everything necessary to define the function calls.

From the Arduino FAQ: The Arduino language is merely a set of C/C++ functions that can be called from your code. Your sketch undergoes minor changes (e.g. automatic generation of function prototypes) and then is passed directly to a C/C++ compiler (avr-g++). All standard C and C++ constructs supported by avr-g++ should work in Arduino. For more details, see the page on the Arduino build process.

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: FacebookInstagram
Reply 0
Pelsea

?????uino

Open source derivatives are one thing, counterfeits are another. This link Makes a clearer explanation than I can. Counterfeit report has a rundown of what to look for.

 To see what you might be letting yourself in for, check out the disappointed customers on Amazon. Note that Amazon sellers change often, and you never know what you are going to get. The current listing is for an Arduino.org board, from the crew that trolled the EU trademark.

I taught graduate art students how to use Arduinos for 8 years, and witnessed several thesis projects derailed by unreliable boards. I guess I'm a bit sensitive on the issue.

pqe

 

Reply 0
Neil Erickson NeilEr

Counterfeit

I got the board with gold chip so all good. The C++ set has been fun to explore - thanks Jim. Components are relatively cheap to a point. I have been wondering how to represent a steam water sight glass and begun to think of an lcd display that could also double for programming but it does take away from my initial goal to keep this an "old school" mechanical input device with brains behind the curtain. 

One question for those who may have built a DCC++ controller would be the need for a H-Bridge or base station when the signal is to be transmitted wirelessly to a battery equipped engine with receiver and decoder.  This weekend I should have time to try the Git-Hub download to create the DCC commands and see if my Tam Valley antennae will function with the 5V output.  

Neil

Neil Erickson, Hawai’i 

My Blogs

Reply 0
Jim at BSME

UNO vs Arduino UNO

Quote:

Open source derivatives are one thing, counterfeits are another. 

My point exactly, know what you are buying, I knew when I bought the Chinese UNO (that is what it is called not Arduino UNO and none of the Arduino logos were on it) that it is an open source derivative and not an official Italian Arduino product or a counterfeit attempt.  As it is a derivative it used a different USB-> serial convertor than the official Arduino product, so I had to find the correct drivers for the CH340 chip and shared that information with others who might buy the Chinese derivative using this chip, of course it did not state what USB-> serial convertor the board used in the description.

This may be one of the issues the Amazon reviews have when they make the statement that the Arduino UNO they bought did not work.  Could also be they got a version without the boot loader, which yes if they thought they were buying an official Arduino they should not have had these problems.  Of course one issue with the reviews is at least some are for a different seller, or at least appear to be as you stated the current seller is Arduino Org and at least one of the reviews was for a counterfeit sold by Silverstone LLC.

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: FacebookInstagram
Reply 0
Jim at BSME

DCC++ H-bridge

Ok I have not built the DCC++ system, but understand the H bridge takes the 5 volt logic level DCC and converts it to the 12-15 DCC signal that would normally be on the rails.  As the Tam Valley system diagram shows the transmitter hooked to the DCC bus the 5v level of the Arduino DCC signal may not be of high enough voltage for the transmitter to pick-up and broadcast.  However I would still try it as there is nothing wrong logically, its just whether the Tam Valley will see the 5v level of the Arduino DCC signal as being a valid, low voltage DCC signal and broadcast the signal.

That would be neat if it works.

As for your sight glass, not sure how you could do it, but I thought about a glass tube with a ball in it and have an air supply that you run to the tube with a variable volume/pressure via a relay controlled pneumatic valve. I would be neat if you could do that, but I am sure this solution would be more expensive and maybe harder to calibrate than the LCD display.

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: FacebookInstagram
Reply 0
RossA

Sight Gauge

Neil,

How about using a linear servo to move a slightly yellowish rod up and down inside a clear outer tube. Should be able to make it look like the water level is going up and down.

Or, maybe I have been spending to much time around Geoff Bunza...

Ross A.

Reply 0
Neil Erickson NeilEr

Blue LED in tube?

... or simply a light bar? The logic for a multiple led light bar would take less pins and the library is an easy solution. The idea of a real glass water sight is appealing but probably not practical. Some compromises will need to be made to be a hand held unit without controls too awkward to manipulate. I'll do a quick SketchUp drawing later today. 

Just for fun it might be fun to build an actual backhead - even 1/2 size - that would provide opportunity for some actual simulation of engineer and fireman functions. Ok. I'm daydreaming again. LoL

Neil

Neil Erickson, Hawai’i 

My Blogs

Reply 0
lnxlnx

DCC++

Quote:

  jim at bsme Ok I have not built the DCC++ system, but understand the H bridge takes the 5 volt logic level DCC and converts it to the 12-15 DCC signal that would normally be on the rails.

Jim and all

The DCC++ system uses the UNO to control the H-Bridge board. The UNO is 5V DC while the H-Bridge board has an additional 12V or more DC supply connected only to the power input of the H-Bridge chip.

The UNO alters the state of the H-Bridge control pins via its digital 5V pins so creating a DCC signal on the H-Bridge output pins from the 12V+ supply. Those output pins are then connect to the track or a DCC booster or any other device that expects a DCC signal.

The additional power supply to the H-Bridge chip is what governs the voltage of the DCC signal and the current draw (as well as the specification of the H-Bridge chip itself to handle the power and voltage)

 

Reply 0
Pelsea

Bar graph?

0SegLED.jpeg 

We use LED bar graphs a lot in audio to display signal levels. There is a wide range available, this is a favorite, since you can stack units to make long displays. They are easy to control with a CD4543 IC.

pqe

Reply 0
Reply