# arduino ?



## J.C. (Dec 24, 2016)

as there is not a electrical forum here , this is a question I ask in an other form when they were discussing Arduino use for layouts and got no response , after googling it and found only circuit boards . so my question is this like a PICAXE ?


----------



## rkenney (Aug 10, 2013)

J.C. said:


> as there is not a electrical forum here , this is a question I ask in an other form when they were discussing Arduino use for layouts and got no response , after googling it and found only circuit boards . so my question is this like a PICAXE ?


Yes, it is a microcontroller.


----------



## gunrunnerjohn (Nov 10, 2010)

Arduino


----------



## Shadow001 (Dec 15, 2016)

That is what they are using for Dcc++? Has anyone tried it?


----------



## Shdwdrgn (Dec 23, 2014)

I tried using an arduino originally for my own HO train, but even the micro pro took up significant space in addition to the wifi module. It turns out the wifi module itself is a much more capable computer chip, running 10x faster, having 1M of flash space instead of 28K, and still is less than half the size of the arduino. So basically I'm now using an ESP8266-12F (for a cost of just over $2 each) to provide full wifi control of my test loco.

Sorry though, I don't have any knowledge of DCC++, but I can tell you that these little computer chips have some serious horsepower and can do a lot.


----------



## J.C. (Dec 24, 2016)

so its a high priced PIC mounted on a board ?


----------



## wvgca (Jan 21, 2013)

Shadow001 said:


> That is what they are using for Dcc++? Has anyone tried it?


Yes, using a Uno and an H-bridge ..
Not using it for the layout itself, just for programming loco's and saving the CV tables, just in case


----------



## RT_Coker (Dec 6, 2012)

I am using a small low cost Bluetooth Arduino-combatable board for wireless HO locomotive control. There are many free development resources for Arduino boards. The C code (firmware) I am using started as Atmega (Arduino) was ported to PIC18 for a HO board that got dropped by the manufacturer, and has just recently been ported back to Atmega for HO locomotive control hardware that uses existing robotic boards.

Most of the DCC++ or (DCCpp) users are unfortunately on a different forum.
Bob


----------



## gregc (Apr 25, 2015)

J.C. said:


> so its a high priced PIC mounted on a board ?


You might think of the Arduino as an evaluation board, similar to a chipKIT Max32 ($49). But I doubt you could build your own board for what an Arduino Uno goes for ($4+).

The Arduino also uses a 2nd processor that supports a USB connection to your PC and used to program the user processor. This 2nd processor also supports serial communication with the user processor thru the USB (serial) port.

The Arduino Mega has 4 serial ports

The Arduino can be programmed in C using its IDE in a less restricted format (i.e. no header files) but can be composed of multiple c/cpp or .ino files.

I recently used an Arduino as a turntable controller using an H-bridge and to interface to the NCE cab-bus to control locomotives.


----------



## Shadow001 (Dec 15, 2016)

Sorry I know next to nothing about this. I just read an article the other day on this and it sounded like they are running layouts with this. 
It was just one article with very little detail, but it sounded interesting. I am at some point going to to some more research on it. (probably months away) Sounds like a inexpensive dcc system. But, I could be completely wrong.


----------



## fcwilt (Sep 27, 2013)

I have found Arduino boards in their various models to be extremely useful for controlling various aspects of a layout.

I currently have 2 Mega's, 1 Uno and 1 Mini handling various tasks.

A bit of background - I use TrainController (TC) to control my layout. I also have a dedicated LocoNet network used by my RR-CirKits Simple Serial Bus devices which are used for occupancy sensing, turnout control, signal control and other misc input/output needs.

The Uno is controlling two servo motors driving a semaphore style three aspect train order signal.

The Uno connects to TC via the LocoNet allowing a standard three aspect TC signal object to control this signal.

One Mega is handling "manual" turnout/uncoupler control via fascia mounted keypads, a controllable power supply for the uncouplers and a LocoNet connection to TC.

The other Mega along with the Mini is controlling my Walthers 130' Turntable which was stripped of the original electronics and fitted with an all new setup of my own design, which addresses the weaknesses of the original Walther's design while adding several new features to make configuring and controlling the turntable much easier.

Lots of things can be done with Arduino's. 

Try 'em - I think you'll like 'em.

Frederick


----------



## Shadow001 (Dec 15, 2016)

fcwilt said:


> Lots of things can be done with Arduino's.
> 
> Try 'em - I think you'll like 'em.
> 
> Frederick


Thanks, I will look into it more once I get all my track layed.

Brian


----------



## Lemonhawk (Sep 24, 2013)

I like the Nano over the uno and mini. Better USB support and smaller size with all the same I/O as the uno. The Mega is great for those tasks that take lots of I/O or ram.


----------



## gregc (Apr 25, 2015)

Lemonhawk said:


> Better USB support and smaller size with all the same I/O as the uno.


why do you say better USB support?


----------



## fcwilt (Sep 27, 2013)

Lemonhawk said:


> I like the Nano over the uno and mini. Better USB support and smaller size with all the same I/O as the uno. The Mega is great for those tasks that take lots of I/O or ram.


The Nano is a fine unit unless you want be able to stack a UNO compatible shield which was true for the train order controller.

I used the Mini for my turntable controller because I was not going to have easy physical access to the USB connector on the Nano. 

With the Mini I just ran the required wires to an accessible external connector and use a FTDI TTL cable when I need to update the program.

Frederick


----------



## Shdwdrgn (Dec 23, 2014)

RT_Coker said:


> I am using a small low cost Bluetooth Arduino-combatable board for wireless HO locomotive control...


Have you looked at the new ESP-32S board? Still not a huge supply of them yet, but I've gotten some from Digikey for $7 including a breakout board (I expect the price to be cut in half once manufacturing is ramped up though). Anyway it has onboard bluetooth and wifi, plus a couple dozen I/O lines that can be used for digital or ADC, and a DAC output. It runs a dual-core processor at 160Mhz with 4M onboard flash, and has SPI and I2C channels, among others. And the whole board is only 18x26mm. I plan on moving my development to this board eventually, but they are currently still working on support under the arduino IDE, especially with the dual-core features (although the general features seem to be in place already). Just thought I'd mention it...

@J.C. --depending on the board you're looking at, they are a lot more than just a high-priced PIC. It used to be that you used arduino if you needed a high I/O count, but with the release of this new ESP board, I can't imagine why anyone would still use an arduino except for extremely low-power solutions?

Did I mention I'm really happy with my ESP boards?  Sure they're not as friendly as something like an arduino Uno, you have to solder wires on very fine pin spacing (2mm on the esp-12 and 0.05" on the esp32s), but I can pack a huge amount of processing power inside an HO loco.


----------



## J.C. (Dec 24, 2016)

Shdwdrgn;1650969
@J.C. --depending on the board you're looking at said:


> wasn't planning to use them , just wanted to know what they as posters on other board think there the greatest thing since premade track. I have don't every thing I want with analog stuff and happy there.


----------



## fcwilt (Sep 27, 2013)

Regards the ESP-32S:

Adafruit is portraying them as "bleeding edge - perhaps not ready for prime time".

They do sound very neat but they are, at this point, not the kind of device I would suggest for newcomers to the world of "micro-controllers".

Frederick


----------



## Shdwdrgn (Dec 23, 2014)

@J.C. -- sometimes I like making things just to see if I can, even if they're already commercially made. For example, one of the project boards I'm working on is a temp/humidity sensor to put in the greenhouse which sends data over wifi back to my server to be collected in a database (the thing I'm stuck on is trying to get it to run on solar). Another project is I have sensors that stick in the ground and read the ground moisture -- would be cool to have several around the yard sending info back to a programmable sprinkler controller.

There's a lot of things that can be done with these computer chips which provide a lot more information than an analog solution would. My current setup with my trains provides exactly the same function as a regular DC power pack (speed and direction), but I plan on adding a lot more intelligence so eventually the trains can run themselves. For me, I love watching how a bit of simple programming can create complex interactions on a larger scale, and this is a great platform to experiment with.

@fcwilt -- Yeah I agree, they are very new and don't have much support yet, but plenty of folks are trying to get ahold of them. Just like every other device, the support will come when everyone can easily obtain them.


----------



## J.C. (Dec 24, 2016)

Shdwdrgn said:


> @J.C. -- sometimes I like making things just to see if I can, even if they're already commercially made. For example, one of the project boards I'm working on is a temp/humidity sensor to put in the greenhouse which sends data over wifi back to my server to be collected in a database (the thing I'm stuck on is trying to get it to run on solar). Another project is I have sensors that stick in the ground and read the ground moisture -- would be cool to have several around the yard sending info back to a programmable sprinkler controller.
> 
> There's a lot of things that can be done with these computer chips which provide a lot more information than an analog solution would. My current setup with my trains provides exactly the same function as a regular DC power pack (speed and direction), but I plan on adding a lot more intelligence so eventually the trains can run themselves. For me, I love watching how a bit of simple programming can create complex interactions on a larger scale, and this is a great platform to experiment with.


love to tinker that way too but seeing's my basic electronic was done in the vacuum tube era analog is about all I can comprehend, as for power for greenhouse not knowing where you are in Colorado but have you considered a wind charger?


----------



## wvgca (Jan 21, 2013)

Shdwdrgn said:


> Another project is I have sensors that stick in the ground and read the ground moisture -- would be cool to have several around the yard sending info back to a programmable sprinkler controller.
> 
> There's a lot of things that can be done with when everyone can easily obtain them.


If you are using analog moisture ensors, the capacitance style work better, with the resistive style moisture sensors there is a concern with galvanic corrosion, which can be reduced by using AC rather than DC .to power them , and read only on one side of the sine wave.
a better approach is the Maxim digital using 1Wire bus.., with multiple sensors either map in code, or map with eeprom in chain ..


----------



## Shdwdrgn (Dec 23, 2014)

Unfortunately I'm in the middle of town, and the greenhouse was placed specifically to protect it from most wind. Interesting idea though, I may be able to collect enough power between wind and solar.


----------



## Lee Willis (Jan 1, 2014)

I looked at this. Its a pretty slick little system and a determined person could self-teach themselves to use it. But its too much like what I did for decades at work for me to have as a hobby, so I passed.


----------



## Shdwdrgn (Dec 23, 2014)

Warren, the ones I have are definitely cheap little resistive types. There's a single small chip on it which I assume is a transistor to amplify the signal, but otherwise there's nothing else to them. I didn't know about the corrosion problem, but then again I haven't really had any time to play with them either. Just one of those things for future days...


----------



## wvgca (Jan 21, 2013)

Shdwdrgn said:


> Warren, the ones I have are definitely cheap little resistive types. There's a single small chip on it which I assume is a transistor to amplify the signal, but otherwise there's nothing else to them. I didn't know about the corrosion problem, but then again I haven't really had any time to play with them either. Just one of those things for future days...


If they are two pin, resistive only ..The three / four pin ones have an on board comparator, with a pot, and they can be set to send a digital hi / low signal depending on moisture percentage..if you read them sporadically corrosion isn't bad, just when you read often, or run them constantly powered up is corrosion an issue, might only get a summer out of them that way ..
The most common [and cheap] ones look like a two prong pickle fork , and are maybe a buck apiece


----------



## Shdwdrgn (Dec 23, 2014)

Yep, sounds like what I have... a red circuit board with two prongs that go in the ground. They are three-pin -- V+, ground, and analog output. Ideally I planned to have the computer take a sample every 5 minutes, then put itself to sleep to save power, so it won't be a continuous read.


----------



## wvgca (Jan 21, 2013)

Those will work okay for you, as far as I remember when using say Arduino A0 , those give a reading of just under 1000 in open air, around 300 in tap water, sometimes down to 100 in alkaline or salty water, using a reverse map function will give moisture percentage that's kind of close ..
You have to saturate the ground first to get a valid sensor low number read to start with ..it can vary quite a bit ..
sample map code "moisture = _map_ (sensorValue, 300, 1023, 100, 0);"
enjoy ..


----------



## feldon30 (Dec 30, 2012)

I'm going to be using Raspberry Pi's (or maybe Arduino) for handling all the lighting and motorized elements of my layout. The main roadblock for me on the Pi was that they have 26 5V outputs, but the maximum power output you can push across the entire board is about *150mA*. That's a pittance -- maybe 10-12 LEDs if you are lucky.

I spoke with friends and one turned me onto the ULN2803A. It's a chip with 8 low power inputs and 8 high power outputs. With some soldering, a 500mA 5V wall wart / cell phone charger, and this $1 chip, you can crank up the power output of a Raspberry Pi or Arduno to support a stepper motor or up to 40 LEDs per chip. With three ULN2803A chips, you could control 120 LEDs on a single Raspberry Pi switchable in 24 groups.


----------



## Shdwdrgn (Dec 23, 2014)

Have you looked at the UN2003A? This is an extremely common chip used typically to directly drive motors. If I'm reading the data sheet correctly, it will drive 500mA to EACH output pin, and it has the same pinout as the 2803.


----------



## feldon30 (Dec 30, 2012)

Shdwdrgn said:


> Have you looked at the UN2003A? This is an extremely common chip used typically to directly drive motors. If I'm reading the data sheet correctly, it will drive 500mA to EACH output pin, and it has the same pinout as the 2803.


Very interesting. I did not know there was such a chip. I looked at the data sheet a few times and it looked like maybe the total output stops at 1.2 amps? That's still a good sight higher than .5! Thanks for giving me something to look at.


----------



## wvgca (Jan 21, 2013)

here ya go ...$12 43A rated .. works just peachy for DCC++


----------

