Skip to main content

Are there any of you guys out there into programmable chips? There are a million things that can be done with these little babies but I don't know much, if anything, about programming them. I can build the hardware and all of the electro/mechanical gizmos that I want to control, I just need some major help with how to get the chip programmed.  I bought a Parallax BASIC Stamp kit and Scott Edwards 8 position relay board years ago and wrote a short program in BASIC to possibly run the Fire Scene at the Choo Choo Barn but ran out of guts to put it into service.  

 

I'd like to be able to vary the speeds of several DC motors from start to full speed and then back down again, making the motors stop at predetermined places, much like an amusement ride would do. (GRIN) Advice, help, condolences are greatly appreciated. 

Original Post

Replies sorted oldest to newest

I've done a lot of work with the Arduino.  I haven't done any motor control applications though;  I've used it to develop an automated control system that runs trains via the TMCC or DCS bases.

 

Arduinos are programmed in C (or C++) which is more fun than BASIC once you ascend the learning curve.  Propellors have their own peculiar dialect although I understand there is now a C compiler for the Prop.

 

Hardware-wise the Prop is more powerful but the Arduino is more than adequate for this sort of application.  If you have TMCC you could even program the Arduino to respond to commands sent out over the TMCC base serial port!

 

There is a very helpful Arduino forum where you can get info about motor control;  this page may give you some ideas as well.

I am sure there are some here that may be able to help you but it has been a long time since I worked on anything like that. Most of the equipment back then used stepping motors to control the precise movement and some sort of sensor to tell when it was exactly where they wanted it. Seems to me like that may be an awful lot for a display item.

 

Al

I developed a lot of stuff for aerospace applications that used synchros and resolvers for position feedback.  We used DC servos and stepper motors, depending on the application. 

 

Are you trying to stop the mechanism that the motor is running at a predetermined place, or the motor shaft at a particular angle?

 

I've been thinking of getting up to speed with the Microchip PIC processor, it's a very cheap and flexible little uP.  I've seen it used in some recent motor control applications.

If you've ever been to the Choo Choo Barn, you've seen my scratch-built Ferris Wheel, down by my Scrambler.  The Ferris Wheel runs all the time and I always thought that it would look better if it would run realistically.  In other words, stopping at each one of the 12 seats, then speeding up and running for 30 seconds or so, then slowing down and stopping at each one of the seats for riders to get on and off.  Sounds like a lot to do, but I’m sure it can be done, especially with today’s electronics and highly efficient DC motors.  I’m not crazy about using DC motors but I can always have spare motors around.

 

A stepper motor is not the answer, they tend to “jerk” with each step and that wouldn’t be good. I don’t think a servo would work either because of the torque needed to move things.  But then again, I may be wrong!

 

 Here's a pic of the drive mechanism.

FW 5

 

This is a pic of my finished wheel.

FW 7

Attachments

Images (2)
  • FW 5
  • FW 7
Last edited by Choo Choo Barn

Well, I think if you look at the current state of the art with stepper motors, you'd see that you can get very smooth movement from them, and even more so when they're geared for such an application. 

 

As far as servos having the power, that all depends on the motor you power it with.  I can show you servos that raise and lower the landing gear on an aircraft, they have plenty of power.

 

For an application like this, I'd probably consider magnets at each seat location to trip a reed switch and stop the seat in the correct position.  This kind of thing could probably be done open-loop with no other feedback, though a speed control on the motor would probably be a good idea.  A simple feedback tach would allow you to apply speed control to the motor so that when you were loading/unloading the wheel would slowly advance to each position, then when you did the run it would go the normal ride speed.  This could all be accomplished with one of the controllers mentioned here with relative ease.

I think the seat thing could be done with  a reed switch and magnet in each seat. The reed switch could activate the coil of a single coil mechanical latch relay coil who's contacts  would alternate polarity + and - to the coils a bank of 12, dpdt  DC coiled relays each with alternating blocking diodes to the coils. Every time the latch relay was pulsed by the magnet and reed switch the relays would latch electrically with one of their own contacts. The second contact would pulse the next relay and latch it when polarity is right. So every seat one relay would latch one at a time. A second contact on the mechanical latch relay would pulse an interval timer and relay which would stop the wheel from moving between seats.    For this operation the motor could get reduced voltage using a diode cascade dropper. Relay 12 on the bank would be 5pdt instead of 2pdt. Contact 3 could restore full voltage to the ride contact 4 breaks reed switch circuit,contact 5 could start delay on timer and relay for ride length time. When it times out power is cut to the relay bank all relays de-energize and cycle is repeated. Relays would need an appropriate power supply. Another timer could be used to shut off the ride for a period of time before resuming between cycles. So we are looking at 3 timers and 18 relays here,some diodes and a reed switch with magnets. Parts maybe $160 depending on what needs doing. Would have to sketch it out but I think it could be made to work. May have to fool a bit with wiring configuration. A bunch of ways to do this.

 

Links to timers mentioned are on my blog. See Mars and Infetec timer modules.

 

http://www.jcstudiosinc.com/Bl...tegoryMain?catId=426

 

Dale H

Tom

 

Here in NE Ohio a lot of the High Schools and Colleges have robotics teams that design robots and then compete against others using computerized inventions ,

 

Often stories in the newspaper telling how  large companies snag the winning team students for employment after graduation.

 

I know your quite active in the community there in Strausburg I wonder if that would not be a source of help.

 

also The ARRL publishes this book and produces a programmer kit

 

http://www.arrl.org/shop/ARRL-...amming-for-Beginners

 

 

Last edited by Jim Teeple

Thanks everyone for your replies.  I use magnetic reed switches all the time, great idea for positioning. I've also been working on a Spider ride for on the layout. It's been in a box on a shelf in my workroom so I have to get back to it. I actually started working on it when Lionel reproduced three of my animations for their Historic Layout Series. I was hoping they would make my Ferris Wheel and then the Spider but the new regime dropped the line. Oh, well, so goes life.

 

Jim, I'll check with the high school to see if they have a robotics club.  What a great source to tap, especially with getting kids involved.

Dale:

I use a lot of different timers that are made for the burglar alarm business. Very reliable and easy to use. They make a latching relay board that will hold until there's another trigger.  I also have a bunch of small mechanical latching relays in my parts box. I love relays, they are the backbone to most of the switching on the CCB layout. I'm looking forward to your diagram or schematic. I probaly already have most of the parts I'd need.

Tom,

 

I have not yet invested time and money in Arduino, or microcontrollers in general (AVR or PIC); however, I am very interested, and have read some about them. Are you familiar with Make magazine? That is where I have read a lot about Arduino. In addition, they have a store that has a lot of Arduino related products, including a "Getting Started with Arduino" kit and book that look interesting. You can likely get these from other sources as well.

 

Just mentioning this as a starting place in the off chance you haven't heard about it before.

 

Will you keep us posted with your progress? (Or at least put it on a future DVD or Youtube!)

 

I am the opposite of you; I have more experience with software than hardware. By the way, I am pretty sure that Arduino does not use C, but a higher-level, possibly easier to work with, programming language of its own. Arduino is AVR based, however, and I suppose you could use any language that supports these microcontrollers (provided your compiler, etc. work with your programmer hardware, if I understand correctly.)

 

Regards,

Jonathan

Arduino implements the avr-gcc compiler, which supports nearly all the features of C++.  It provides a user-friendly IDE and hardware system to make programming the AVR chip pretty painless, and additionally simplifies the C coding process a little (like automatically generating function prototypes).

 

There are also some Arduino macros and functions to simplify common tasks like digital I/O and serial communications, as well as many libraries available for external hardware interfacing and peripherals (I2C, SPI, motors, ethernet, etc. etc.)

 

I find the Arduino Mega handy because it has 4 built-in serial ports;  I can talk to the Legacy base, the TIU, a RFID reader, and two separate connections to an external computer all at the same time.

Originally Posted by Choo Choo Barn:

Dale:

I use a lot of different timers that are made for the burglar alarm business. Very reliable and easy to use. They make a latching relay board that will hold until there's another trigger.  I also have a bunch of small mechanical latching relays in my parts box. I love relays, they are the backbone to most of the switching on the CCB layout. I'm looking forward to your diagram or schematic. I probaly already have most of the parts I'd need.

Tom

 

After further thought I think you can accomplish what your want with 3 timers,1 single shot and 2 delay on make such as Mars 32391 and 3 relays 2, SPDT and 1, 3pdt. each in series with one of the above timers. These can be run off a filtered 24VDC supply for example made from 18VAC with a bridge and capacitor. My single shot timer is 12 volt so would require a 7812 regulator shown below and a 12 vdc relay.

 

http://www.jcstudiosinc.com/BlogShowThread?id=478&categoryId=426

 

Mars timer circuits

 

http://www.jcstudiosinc.com/Bl...1&categoryId=426

 

The DC motor voltage for the wheel could be run through a string of 3 amp diodes to reduce voltage,thus speed, to the motor and through the NC contacts of relay one controlled by the single shot timer. Reed switch and magnets on each seat on the wheel as mentioned before.

 

The reed switch in series to one set of NC contacts of relay two, when closed triggers the single shot timer (wired directly to the filtered DC supply) which opens the relay for a set time (5 seconds for example) and breaks voltage to the motor stopping the wheel for that time, then the wheel resumes. If wired this way the reed switch would trigger each time the magnet in the seat trips it unless relay 2 is open..

 

Relay two is 3pdt and its coil is wired in series with a delay on make timer module through the NC contacts of a relay three. Relay two timer is set for 12 times the duration of timer 1 (60 seconds for example). After that set time the wheel has stopped 12 times, once for each seat,then relay 2 opens. One set of contacts breaks the reed switch circuit so the wheel does not stop at each seat. A second set of contacts jumps out the diode string so the wheel runs at full speed. A third set powers a delay on make timer module in series to relay three coil. After the set time (2 minutes ride time duration for example) relay 3 opens,its contacts disconnecting power to timer and relay 2,resetting it. When relay 2 opens relay 3 drops out and timer 3 is reset. A small capacitor may be needed across coil 3 to allow time for timer to reset..

 

The cycle is then repeated with the wheel stopping at each seat until timer 2 comes on again,then timer 3.. With an additional relay and capacitor run off timer 2 or 3 further speed staging could be accomplished so the wheel slows down a bit before stopping to unload riders.

 

Try drawing this out. If it is not clear I will try to post a diagram later.

 

Dale H

 

Originally Posted by Choo Choo Barn:

Are there any of you guys out there into programmable chips? There are a million things that can be done with these little babies but I don't know much, if anything, about programming them. I can build the hardware and all of the electro/mechanical gizmos that I want to control, I just need some major help with how to get the chip programmed.  I bought a Parallax BASIC Stamp kit and Scott Edwards 8 position relay board years ago and wrote a short program in BASIC to possibly run the Fire Scene at the Choo Choo Barn but ran out of guts to put it into service.  

 

I'd like to be able to vary the speeds of several DC motors from start to full speed and then back down again, making the motors stop at predetermined places, much like an amusement ride would do. (GRIN) Advice, help, condolences are greatly appreciated. 

 

Hi Tom,

 

Been mostly lurking here and on some other boards ... want to get back into O gauge in a serious way.   Anyway, yes, I've been working with Arduino with the intention to build a system to control my trains.  I'm a software programmer by trade and find the Arduino development environment truly genius.  Right now I'm working with a Pololu motor controller and some Zigbee wireless modules and am having a blast.  Have all the shields working individually but have not yet combined all the pieces into a complete package, that's next.  I intend to use one Arduino+Zigbee as a remote and then install a Arduino+Zigbee+Pololu controller pack in each of my trains.

 

I've looked at some of the other microcontrollers out there such as the Propeller and PICAXE.  All look to be very capable and I believe for what you want to do any would work, though I'd wager the Propeller would be overkill.  Given the size of the user community behind the Arduino, however, I don't think you'd go wrong if you settled on that.  

 

By the way, the Zigbee wireless units can work in either a hierarchical or mesh network, so they'd be perfect for your setup at the ChooChooBarn: you could have multiple Zigbees scattered across the layout talking to a master Zigbee in your control room.

 

Was down to Strasburg for the first time last fall and loved the ChooChooBarn.   ...  yeah, I know, I know, no excuses for why it took me so long to make my first trip

 

Hey, feel free to contact me off-list if you like to discuss further.

 

Tim

Originally Posted by skip:
Are you talking about EPROMS and PROMS. 

As programmable chips go, an EPROM might be the cheapest method and does not require writing software. Writing code in C or C++ can be an enriching experience, but it’s not for everyone. An EPROM can be the electronic equivalent of a player piano roll or music box cam. Instead of holes in a paper roll or pins in a cam that mechanically enable discrete animations, each EPROM memory bit drives a discrete function. 

 

For example:

 

ferris

 

An 8-bit digital counter IC (50 cents) counts at 1 Hz counting from 0 to 255. The counter output addresses an EPROM ($1-2) that has 256 locations - not that you can easily find a memory chip this small anymore. Each location stores 8 bits. The output of the EPROM changes every second with a pattern that controls the animation. I think it can be done with 3 of the 8 outputs.  It might go something like this. On count 0 the slow bit turns on the motor slowly, this moves the seat away from the magnet, on count 2 (2 sec later) the reed switch is enabled which will turn the motor off when the next seat arrives after a few more seconds.  For the next several counts nothing is output and the wheel is stopped as riders unload/load. The above repeats 12 times to run 12 seats.  Then for the next 60 counts (60 sec), the fast bit which drives the motor quickly is enabled and the reed switch is disabled so it does not stop.  The counter re-cycles back to 0 and everything repeats.

 

It looks like you have a DC motor so I’d drive the motor with a transistor instead of a relay(s). A capacitor or two is needed to ramp the motor voltage to avoid rider whiplash. Parts cost would be about $10.

 

Unfortunately, there are logistical issues that make this difficult to implement such as finding and dusting off the tools that program these EPROM chips. I won’t call this a practical solution but it’s an alternative.

 

Attachments

Images (1)
  • ferris
Originally Posted by Choo Choo Barn:
Jim, I'll check with the high school to see if they have a robotics club.  What a great source to tap, especially with getting kids involved.

This is a really good suggestion. The FIRST robotics season is still going so it may be hard to get their attention now but try in a month or two. At the local high school robotics team I'd guess there are a half-dozen kids who could whip up some code that would do what you want. The controller they use for competition is much more sophisticated (and expensive!) than an Arduino but most schools use such development boards to get the kids started with programming. Our HS happens to use the Texas Instruments LaunchPad which is only $4.30 (not a typo) but there's nowhere near the support base as the Arduino.

 

I suggest you make an interface connector to your wheel so that you can swap in/out different control methods. That way if you find some kids to help with an Arduino or whatever, they can simply plug into the connector. Independently, you can make a discrete implementation with relays, timers, etc. and swap that in.  Such a side-by-side would be a good teaching aid for the kids contrasting software vs. hardware design. The connector would be fairly simple – 2 pins to motor, 2 pins to reed switch, and possibly a few more for a tach sensor (if needed), once/rev sensor (if needed), LED power to light the wheel (if needed), whatever.

 

Tom,

 

Go with the Arduino if you are going to program anything.  I found it to be the easiest system to use - it was designed for artists and non-computer scientists - I am the latter.  There is loads of support out there, almost to the point that you could cut and paste the code.  I would recommend getting one and diving in with the blinking light tutorial.  This kid has some good tutorials, tutorial 05 deals with motors:

http://www.youtube.com/playlis...A84&feature=plcp

 

The disadvantages of Arduino compared to other chips (namely cost) just are not that relevant for small projects.  If you need to, you can use the Arduino chip in a much less expensive configuration once you have prototyped your animation.  It is more important to use something that can get the job done effectively.  After studying electronics and fiddling with circuits, I found that it is much easier (for me) to just program an Arduino to do what I want.  Sure it is overkill, but it gets the job done.  With one Arduino board you could control your Ferris wheel and a bunch of sequenced lights and even turn on and off audio all synchronized with the movement of the wheel. 

 

Here are some examples:

 

Motor control: You can buy a "Shield" which plugs right into the Arduino board to control motors.

http://www.sparkfun.com/products/10267

http://207.58.139.247/products/81

http://www.ladyada.net/make/mshield/use.html

 

Ferris Wheel:  Here is an example of what you want to do with a K'nex elevator. http://www.youtube.com/watch?v=zzBjbDathWQ

 

Stopping to let passengers on:  With a stepper motor you shouldn't require any reed switch.  The motor and the program can keep track of the wheel position and stop at a passenger car.  It could also be programmed to function like the prototype: stop at a seat, make a few complete revolutions and then stop at another seat.

 

Stepper motor:  I would buy a decent one from one of the suppliers instead of recycling.  That way, you will know all the control elements you will need to program it.  Arduino has a stepper motor library, which makes it easy to write programs for stepper motors.

http://www.sparkfun.com/search...er&what=products

https://www.adafruit.com/index...&keyword=stepper

 

Here is what a simple stepper motor control program looks like (follow link to "Arduino code example" on that page):

http://www.me.umn.edu/courses/.../arduinoStepper.html

 

Good luck - Feel free to contact me via email if I can offer any other help.

 

Phil

I've made some small train animation projects using small ATMEL AT Tiny and Microchip

PIC 16F processors. This is one card I built that hooks to a track block. I can select one of four throttles per block. It has a current sensor that detects a block occupied or not, and it has 8-bits of digital input. Runs from a RS-485 network.

 

 

   

 

Regards,

PICs are the way to go. Small (8 pin dip), cheap (about 50 cents), easy to use because the development system is free from Microchip including the C++. Only thing you have to buy is a programmer ($30) or build one yourself. I've done dozens of circuits for model train companies including TAS, Atlas, Williams, Custom Signals, Berkshire Junction. As an example I would use a PIC instead of a 555 timer for even a simple timer circuit. No caps or resistors required and you can do any kind of waveform for any amount of time. Did one as a test that took 2 days to time out accurate to several minutes. Gary MXRobotix

This thread got my programming juices flowing so I ordered an Arduino just to see what the hype was about. This thing is a blast to work with. I ordered the kit with all of the small parts and have absolutely no regrets.

I spend about two weeks a month in Germany and have many idle hours to deal with. Everything fits easily in a small cigar box and will be easy to travel with.

Thanks for the enlightenment

Denny

Tom,

 

Can you specify what the inputs (sensors) and output (controls) would be?

 

For instance can need an output to drive the motor, maybe an output to activate the lights?  Any sounds that can be triggered?  

 

Is the motor a simple motor or a stepper?  Would your drive it at say a few select voltage levels lo, med, hi?

 

Are there inputs to help determine the position of the wheel?  Like a reed switch that trips as each car passes?

 

Animated lights to be driven?

Post

OGR Publishing, Inc., 1310 Eastside Centre Ct, Ste 6, Mountain Home, AR 72653
800-980-OGRR (6477)
www.ogaugerr.com

×
×
×
×
Link copied to your clipboard.
×
×