Author Topic: Anyone integrate Arduino/Raspberry Pi into your model trains?  (Read 6881 times)

0 Members and 2 Guests are viewing this topic.

Mark W

  • Crew
  • *
  • Posts: 1988
  • Respect: +2125
    • Free-moNebraska
Anyone integrate Arduino/Raspberry Pi into your model trains?
« on: October 15, 2014, 12:15:47 AM »
0
I've been keeping a very loose eye on these seemingly too good to be true microcomputers for a while.  This past week something sparked and found myself reading all I can, and ordered the latest Raspberry Pi.  My goal is to set it up and control advanced automated/interactive lighting, automated crossing control, and some type of turnout control for some of my Free-MoN modules. 

Has anyone else looked at/used any of these practically "disposable" microcomputers? 
Contact me about custom model building.
Learn more about Free-moNebraska.
Learn more about HOn3-mo.

railnerd

  • Crew
  • *
  • Posts: 764
  • Gender: Male
  • Respect: +230
Re: Anyone integrate Arduino/Raspberry Pi into your model trains?
« Reply #1 on: October 15, 2014, 12:36:06 AM »
0
Mark,

Before I got busy with the day job, I have hacked my Pi to talk to my NCE PowerCab.

Java and hence JMRI runs dog slow on the Pi— so I hacked my own code to control my Bachmann 44 tonner on a loop of UniTrak.

-Dave

babbo_enzo

  • Crew
  • *
  • Posts: 200
  • Gender: Male
  • Respect: +12
    • Experience IT!
Re: Anyone integrate Arduino/Raspberry Pi into your model trains?
« Reply #2 on: October 15, 2014, 04:48:12 AM »
0
I'm in progress of my first project with Arduino : a Speedometer ( 2x16 LCD + 2 x IR sensors ).
I will post also here when is finish if interest.

Then I've plans for a FastClock system:
I think of a master with a little LCD and keys to setup, wireless connectable to a pair of slave on the wall with "big" diplays ( Led?)
I know there are some RTR products around, but this is one more side of a hobby for me.

Mark W

  • Crew
  • *
  • Posts: 1988
  • Respect: +2125
    • Free-moNebraska
Re: Anyone integrate Arduino/Raspberry Pi into your model trains?
« Reply #3 on: October 15, 2014, 07:39:57 PM »
0
Cool Dave.  I wasn't thinking integrate with the DCC system, just a stand-alone controller for layout ambiance.  But now you have me thinking about even more possibilities.  However, most of them are definitely beyond my abilities at this point.

Enzo, that's awesome!  I was thinking about speedometers also.  Did you set up your IR sensors to be discrete within the layout surroundings or are they crude?   Would love to see installation photos and more info if you're willing to share.
Contact me about custom model building.
Learn more about Free-moNebraska.
Learn more about HOn3-mo.

babbo_enzo

  • Crew
  • *
  • Posts: 200
  • Gender: Male
  • Respect: +12
    • Experience IT!
Re: Anyone integrate Arduino/Raspberry Pi into your model trains?
« Reply #4 on: October 16, 2014, 04:30:24 AM »
0
...Did you set up your IR sensors to be discrete within the layout surroundings or are they crude?   Would love to see installation photos and more info if you're willing to share.
Well, at this stage I'm ... still waiting to receive 5 Arduino Nano from China, so I'm testing using one mega2560 card (but I know pins are different from Nano) and and joking with software ....

Open a dedicated topic to don't fool this one  ;)
See here :
https://www.therailwire.net/forum/index.php?topic=34262
« Last Edit: October 16, 2014, 12:26:06 PM by babbo_enzo »

conrail98

  • Crew
  • *
  • Posts: 1456
  • Gender: Male
  • Respect: +41
Re: Anyone integrate Arduino/Raspberry Pi into your model trains?
« Reply #5 on: October 16, 2014, 12:02:57 PM »
0
I've actually been looking at Tessel, https://tessel.io, and their servo module to control switches. It can operate over wifi also. Don't know if anyone has looked at incorporating this into JMRI or not but it is something I want to investigate some more,

Phil
- Phil

babbo_enzo

  • Crew
  • *
  • Posts: 200
  • Gender: Male
  • Respect: +12
    • Experience IT!
Re: Anyone integrate Arduino/Raspberry Pi into your model trains?
« Reply #6 on: October 16, 2014, 12:19:03 PM »
0
I've actually been looking at Tessel, https://tessel.io, and their servo module to control switches. It can operate over wifi also. Don't know if anyone has looked at incorporating this into JMRI or not but it is something I want to investigate some more,
Phil
Phil, you're comparing a $3 cpu like Arduino with a $75 one ( ok it have wi-fi connection and run java, but... apple with apple, agree ?)
Anyway nobody do nothing on Jmri-2-Tessel connection, as I know at this moment... do you want be first?
As per servo driver, there is a topic on MRH using Arduino, servos, and DCC. Not complete ( at least to me: I like my Tam Valley octopus to much) but a really good starting point.
http://model-railroad-hobbyist.com/node/19070
http://model-railroad-hobbyist.com/node/19446

conrail98

  • Crew
  • *
  • Posts: 1456
  • Gender: Male
  • Respect: +41
Re: Anyone integrate Arduino/Raspberry Pi into your model trains?
« Reply #7 on: October 16, 2014, 01:20:37 PM »
0
Phil, you're comparing a $3 cpu like Arduino with a $75 one ( ok it have wi-fi connection and run java, but... apple with apple, agree ?)

Actually, it runs Javascript which is why I'm looking at it since my day job is web programming. What I will say is you can stack these types of devices together much easier. The $3 Arduino isn't going to get you far from a functionality perspective without add-ons. Also, reacting to "events" is a much more model railroady thing then having loops checking sensors. Here's what peaked my interest on Tessel. Conceivably, in one board for a town, I could control up to 16 servos, have 20 general I/O to light LEDs for signals entering and leaving the town, possibly stick and RFID card in there to read the cars/trains as they move through the town. To me, it's the expandability, internet connectivity out of the box that piques my interest. I've been following Arduino/Model Railroad conversations as well, I just want to try some things with Tessel and see if it's worth pursing it more,

Phil
- Phil

peteski

  • Crew
  • *
  • Posts: 32958
  • Gender: Male
  • Honorary Resident Curmudgeon
  • Respect: +5343
    • Coming (not so) soon...
Re: Anyone integrate Arduino/Raspberry Pi into your model trains?
« Reply #8 on: October 16, 2014, 03:00:18 PM »
0
Actually, it runs Javascript which is why I'm looking at it since my day job is web programming......Also, reacting to "events" is a much more model railroady thing then having loops checking sensors.

LOL!  You high-level programmers make me smile.  Events?!  That's for sissies!  ;) I remember in the 80s programming a Z80 microprocessor-based computers in machine language.  You can't get any lower than that!  Loops and interrupt routines was the way to do everything.  And it worked just fine.   If you dive down deep under the covers, even your fancy events are eventually turned into those loops.  :D

But yes, dealing with computers at your level is much more human-friendly than machine language.
. . . 42 . . .

railnerd

  • Crew
  • *
  • Posts: 764
  • Gender: Male
  • Respect: +230
Re: Anyone integrate Arduino/Raspberry Pi into your model trains?
« Reply #9 on: October 16, 2014, 07:19:09 PM »
0
Funny you should mention Javascript.  I hacked together an npm module for talking to the NCE system (via node-serialport), and another one for talking to JMRI xmlio.

One of these days I need to share those on github.

-Dave

daniel_leavitt2000

  • Crew
  • *
  • Posts: 6345
  • Respect: +1307
Re: Anyone integrate Arduino/Raspberry Pi into your model trains?
« Reply #10 on: October 16, 2014, 11:21:53 PM »
0
Would the Intel Quark run JavaScript any better now that is will have Windows Embedded on it? Couldn't you just lead up a stock copy of JMRI?
There's a shyness found in reason
Apprehensive influence swallow away
You seem to feel abysmal take it
Then you're careful grace for sure
Kinda like the way you're breathing
Kinda like the way you keep looking away

C855B

  • Crew
  • *
  • Posts: 10872
  • Respect: +2421
Re: Anyone integrate Arduino/Raspberry Pi into your model trains?
« Reply #11 on: October 16, 2014, 11:49:48 PM »
0
Thanks for the advice about Raspberry Pi not having the horsepower to run JMRI. Saves me the trouble - when I looked at it when it first delivered, there were also a lot of dependencies to resolve to get JMRI to run. (Too much work experience resolving Linux dependencies... no interest repeating that agony with hobby stuff.) That may or may not still be the case, but OTOH I have plenty of not-that-old full-blown PC hardware gathering dust that would be fine for JMRI.

So... no firsthand experience yet, but I'm looking at Raspberry Pi as a dedicated front-end to view RTSP video streams, and Arduino with an I/O breakout as a standalone signaling logic solution. Won't be messing with either for a while; other projects have priority right now.
...mike

http://www.gibboncozadandwestern.com

Note: Images linked in my postings are on an HTTP server, not HTTPS. Enable "mixed content" in your browser to view.

There are over 1000 images on this server. Not changing anytime soon.

Mark W

  • Crew
  • *
  • Posts: 1988
  • Respect: +2125
    • Free-moNebraska
Re: Anyone integrate Arduino/Raspberry Pi into your model trains?
« Reply #12 on: October 20, 2014, 01:10:46 AM »
0
I've been reading up in preparation for my Pi's arrival on Wednesday.  I see they've been working with Oracle to get Java working much better on the Pi. 

http://www.oracle.com/technetwork/articles/java/raspberrypi-1704896.html

And this is two years ago, there's now a newer faster model of Pi.  Curious which model Dave worked with and if things might have improved as well as it's advertised. 
Contact me about custom model building.
Learn more about Free-moNebraska.
Learn more about HOn3-mo.

railnerd

  • Crew
  • *
  • Posts: 764
  • Gender: Male
  • Respect: +230
Re: Anyone integrate Arduino/Raspberry Pi into your model trains?
« Reply #13 on: October 20, 2014, 06:15:32 PM »
0
And this is two years ago, there's now a newer faster model of Pi.  Curious which model Dave worked with and if things might have improved as well as it's advertised.

The Pi is still a 700MHz ARM1176JZF-S.  My unit was an original model B, which had HALF of the RAM of the currently shipping model.

The newer Pi CPU isn't faster, but more RAM should help a bit.

-Dave

Mark W

  • Crew
  • *
  • Posts: 1988
  • Respect: +2125
    • Free-moNebraska
Re: Anyone integrate Arduino/Raspberry Pi into your model trains?
« Reply #14 on: October 26, 2014, 11:35:40 PM »
0
Nothing to show yet, but making good progress.  These things are definitely a neat little toy with loads of possibilities!

I've got LEDs animating, including PWM dimming driven by a set schedule or various sensor triggers. 

I've also programmed a momentary push button turnout control, including directional lights.  One button, on press, if set straight: throw to diverge and show red, if set diverge: throw to straight and show green. 
I'm using software based PWM on the GPIO to drive the servo, but having trouble.  When I send a raw .005 pulse it moves one way, and the .025 pulse moves the opposite.  But when I send each pulse via the control program, both widths turn the servo the same direction.  Will keep experimenting.

I have a bunch of micro LED's on the way, and also a stepper motor, belt, and sprockets for another project, a timelapse slider for my astro-timelapse hobby.
Contact me about custom model building.
Learn more about Free-moNebraska.
Learn more about HOn3-mo.