Jump to content
 

Shelf Marshes (first attempt at a cameo layout)


47137
 Share

Recommended Posts

  • RMweb Premium

I bought an LCD for the Arduino as a Christmas present for myself, but the charity shop where I work has been forced to close (. third time this year .) so I have been learning about the LCD instead. My ancient Panasonic laptop is running fine with its new operating system, and the Arduino development environment uses the correct serial port every time:

P1020758.jpg.931e44ffca5ae14e7f8092e5de5b4205.jpg

 

I have written a very simple program to display a series of pages to describe the layout. So far I have managed six drawings of engines in "ASCII Art" style and 10 pages of narrative explanations. Examples:

P1020761.JPG.b08fbd4bca687362ebe48dc4f781577b.JPG

 

P1020762.JPG.aa435a104d79c410b8227c20372d30a9.JPG

 

This lot is consuming only about a fifth of the Arduino's flash memory, so I could add many more pages. I could describe the layout and explain a bit about what is going on.

 

The title page at least is reasonably finished now, and proudly states the scale and subject!

P1020764.JPG.81d189459674ad44f7f601d5d64868ba.JPG

 

Incidentally, the display contrast is just right for normal viewing, but I could tweak it for photos.

 

So ... the plan is to use this Arduino as a sort of "ancillary scenics processor" to handle most of the animations on the layout and this display. Possibly add a real-time clock module or a temperature sensor, to try out something new. This is very much a learning exercise for me with no pressure (I don't care if I have to give up), to work myself up to writing some better code for the separate Arduino connected to the Magnorail system.

 

I am thinking of building the display into the side of a building or maybe an advertising hoarding, in much the place it is here on the layout. This will make it visible regardless of whether the layout has its lighting rig in place.

 

As far as I can make out, this topic gets about a hundred views with each new post. I am putting very little scale-specific material here and I do hope people can pick up on anything useful, regardless of the scale they are using. It all seems like a monologue sometimes, but the project is growing nicely and I am happy with it.

 

Wishing everyone a pleasant if low-key Christmas, in these rather trying if not downright tragic circumstances.

 

- Richard.

  • Like 2
  • Friendly/supportive 2
Link to post
Share on other sites

  • RMweb Gold
11 hours ago, 47137 said:

... It all seems like a monologue sometimes, but the project is growing nicely and I am happy with it.

Sorry about the current lack of input from me. In my defence, this photo shows the trouble I have fitting a simple dropper resistor. It's called, at least in my own mind,  "The Day Ohm's Law Broke Down", and it explains why an Arduino literally leaves me speechless:

Middenshirecontroller-thedayOhmsLawbrokedown.JPG.d7950437c8f973df487a48b8c4826867.JPG

 

Wishing you and all your readers a very Happy Christmas and a Better New Year!

Ian

 

 

 

  • Friendly/supportive 1
Link to post
Share on other sites

  • RMweb Premium

When I find myself using low-value resistors I always end up doing many iterations.

 

I'm not too sure what you are doing here but if you are wanting to lose a volt or two, regardless of the load, a few silicon diodes in series might work. Each diode drops about 0.6V. If you want the circuit to be reversible, put a matching chain of diodes facing the other way in parallel with the first.

 

Those 9V batteries don't contain very much electricity so to speak. If you don't need portability, you could try a DC-DC convertor like this:

https://ebay.us/72bDAx

driven from a spare wall wart plug you have lying around.

 

Let me know how you get on. I may have to stay away from the keyboard for the rest of today, because of the date, to avoid getting shot, but I'll be back.

 

- Richard.

  • Informative/Useful 1
Link to post
Share on other sites

  • RMweb Gold

Many thanks, Richard. I'm glad it's not just me that has to play around with low value resistors!  I felt like the Burser in the Discworld novels, who believes the decimal point is an optional extra, when I found the correct resistance was around ten times larger than I had expected.

Thanks for the hint on diodes - I didn't know they reduced voltage, and I can definitely see several uses for that.

The battery controller is really just a project driven by the KISS (Keep It Simple, Stupid) principle, although the portability is a plus as well and I've now packed away the mains controller. The general test for tech on Tinories is "would a Victorian twelve-year-old understand how it works?" If the answer is Yes, then there's a fair chance that I will understand it as well.

You're right about the limited amount of charge in a battery, but I only run my layout for a few minutes at a time and I think rechargeable batteries will be cost-effective. BTW I've been looking at the Rokuhan battery controllers with interest, as it suggests there must still be some demand for a battery option.

Edited by Ian Simpson
Added link to Rokuhan controller as I've only just heard about them. (They can use 8 AAA batteries as an alternative to mains control.)
Link to post
Share on other sites

  • RMweb Premium

I had a look at battery power for a control panel, but I decided if I was going to run three wires for the serial control data, I might as well add a fourth wire for a supply of power. It was as though batteries are best when the item wants to be wireless.

 

I wonder if a solar panel would be enough here? After all, you run quite short trains, and they go quite slowly. This might need a bit of fiddling around to get enough volts. A solar charger for a car battery?

 

- Richard.

Link to post
Share on other sites

  • RMweb Premium

A week on, my Arduino display now has a selection of pages to describe the layout, the loco roster and, when a sensor arrives in the post, the weather. This is the latest prototype - nothing to it really:

 

P1020774.JPG.9b0e26bc5c1a472d920b0a1ecc44fb28.JPG

 

It has dawned on me (eventually), if I have a display I can have a user interface. So the system now has two buttons labelled “YES” and “NO” and some suitably user-hostile prompts to get inputs to change the roster:

P1020770.JPG.a083f1e8e7079b348bb2adf9d1d5ed28.JPG

 

I have endured plenty of software like this during my life, so it seems only natural to create some of my own.

 

And, only two Arduino inputs used to change whatever settings I can dream up.

 

The layout has a PIR sensor embedded into one of its ‘wings’. I put this in to trigger the animations, but maybe it would be neater to fire off a “please do not touch” message on the display?

 

In the meantime, I have added a get-out screen for occasions when I remove all of the locos from the roster :-)

P1020772.JPG.14e3c3ec7e024f8237f03256038ba729.JPG

 

- Richard.

  • Like 2
  • Funny 1
Link to post
Share on other sites

  • 2 weeks later...
  • RMweb Premium

I have finished the code for my "scenics processor". This has ended up just like building a layout; I keep on thinking of new details, and eventually decide to simply stop.

 

My "scenics processor" is one Arduino Nano, and it is currently driving three servos, an LED replicating a rotating strobe lamp, and a narrative display. All of these are running at the same time and are working to their own schedules:

P1020779.JPG.8a53df11485d48192f57ea38a62294fc.JPG

 

The white lump on the harness to the left of this arrangement is a temperature and humidity sensor, so the display can include a "weather report" based on the local conditions and, arguably, the whole shebang can be seen to be doing something useful. (The breadboard is holding a switch, the Arduino behind the breadboard is doing nothing).

 

The success of this is entirely due to my being able to construct a couple of C++ classes, one to drive a servo object and one to drive an LED object, and get them to compile and indeed work! Without these, I think I would have split the display, servos and LEDs across several individual Arduinos.

 

The source code is just over a thousand lines; about a quarter of this is comments and white space, and another chunk is text strings for the display, but its size has pretty much reached the limit of what I can cope with in one file. The project is using about two-thirds of the flash memory in the Arduino (I'm happy to use most all of this) and one-third of the RAM (so I am happy the code isn't going to run out of space when it runs).

 

I have a PIR sensor built into the layout, and I need to integrate this into the software. When this is working, the software side of the "scenics processor" should be done for the time being and I can put in the wiring for the various animations.

 

I feel I have somewhat blackened my nose with Arduino software. I began with my Magnorail project, this was too ambitious at the time so I tried this scenics processor and then a model barrier. I am now working my way back up this chain, so I can return to the Magnorail with a bit more knowledge and confidence.

 

- Richard.

  • Craftsmanship/clever 2
Link to post
Share on other sites

  • RMweb Premium

I have installed my "scenics processor" under the baseboard:

DSCF1372.jpg.27b89c68db605a10f5374b1489e7759b.jpg

 

For some reason it looks neater in the flesh than it does here. The board is finally running from layout power and not its USB port.

 

I still ended up phoning a friend for help with one of the functions. I don't know why I struggle so much with software; all I know is that sometimes, the ideas and the code seem to come naturally enough, and at other times I am completely stuck.

 

I will hardly ever want to alter the configuration, so I have tucked the two buttons "yes" and "no" away out of sight. With a bit of luck, I will still be able to reach them if the layout is resting on its trestle table, or on its wall brackets, or on whatever trestles I use at a show.

 

I am running out of spare real estate under the baseboard, hence the note about a "signal actuat(or). I want to put a signal with a servo here one day, and I very nearly screwed the Arduino in its place.

 

I want to move back to my Magnorail system now.

 

- Richard.

 

 

 

  • Like 2
  • Friendly/supportive 1
Link to post
Share on other sites

6 hours ago, 47137 said:

For some reason it looks neater in the flesh than it does here.

Richard,

 

It all looks perfectly neat and tidy to me! I hope the extra work involved pays off.

 

Ian

  • Thanks 1
Link to post
Share on other sites

  • RMweb Premium

I have started my second box of cable clips (100 in a box).

 

With the layout tipped up and resting on its rear backscene, horizontal cable runs are in trunking and vertical runs are clipped into cableforms. It will all look ok when the trunking lids go on.

 

So far, I haven't written down anything to do with the wiring (gulp!). I am working on the basis, the cableforms are small bundles. I never put more than three wires of the same colour together, and it is fairly easy to see where they are going, "so I don't need a schematic". After all, the wiring is pretty simple - there are a lot of circuits but they are nearly all the same sort of thing e.g. a servo, a light or a track feed. There are very few one-offs like the connection to a display or a switch.

 

This may well be a flawed approach, but a previous layout had a smaller quantity of much more bulky cableforms, white wire throughout (no colours) with numbered ident sleeves on every wire, and a 400-row spreadsheet to explain each wire. I had to have a printout in my hand to solve any problem or indeed alter anything. And the spreadsheet was a pain to keep up to date.

 

I need to find a happy medium. It might be a series of A4 pages, each page showing a sketch of a pcb or module and its connected wiring? This would cover everything except the individual track feeds.

 

- Richard.

  • Friendly/supportive 1
Link to post
Share on other sites

Richard.

2 hours ago, 47137 said:

I have started my second box of cable clips (100 in a box).

I get through those clips at a right rate. It's not the clips that bother me, they're cheap, it's the No.0 screws to attach them. Those are a tad expensive.

3 hours ago, 47137 said:

So far, I haven't written down anything to do with the wiring (gulp!).

I actually drew up my cabling plan for a couple of baseboards before I did any installation. However, I soon found that I was simply repeating the same 'cabling design' but just in different arrangements, and so I didn't bother with any more drawings. However, I have made a considerable effort to 'label' all the plugs, sockets, stripboards, cables, servos to make sure it can be understood at a later date.

 

And I always follow the 'back to black' rule for cabling ...

 

Ian

 

Link to post
Share on other sites

  • RMweb Premium
5 hours ago, sb67 said:

That looks like it's all progressing nicely Richard. I got to say the wiring side of our hobby battles me, no matter how neat and tidy I try and be it always looks like spaghetti! 

I am cheating :-)

 

The wiring is neat and tidy at its ends, but the excess is doubled back inside the plastic trunking. If I mess up making off the end of a wire, I use up a bit of the surplus and no-one is any the wiser.

 

- Richard.

  • Like 1
Link to post
Share on other sites

On 15/01/2021 at 11:34, 47137 said:

So far, I haven't written down anything to do with the wiring (gulp!).

 

On 15/01/2021 at 11:34, 47137 said:

I need to find a happy medium. It might be a series of A4 pages, each page showing a sketch of a pcb or module and its connected wiring?

Richard,

 

Have you considered using photos strategically marked up (electronically of course) with the salient features and notes?

 

I'm beginning to see quite a benefit in having my layout build recorded in photos posted on RMWEb, and adding a few notes and descriptions would serve as a good record.

 

Ian

Link to post
Share on other sites

  • RMweb Premium

I think some marked-up photos could work well.

 

My computer is in the office, the layout is in my hobby room, so a manual method would be best for me. If I desaturated them and printed them out on A4 paper, I could mark them up by hand and put them into a ring binder. Ten or twelve photos would cover the underside of the layout.

 

What I need to do, is stop altering the wiring. The Magnorail system is going through multiple iterations at the moment.

 

- Richard.

Link to post
Share on other sites

On 15/01/2021 at 11:34, 47137 said:

I have started my second box of cable clips (100 in a box).

Richard,

 

I just received an order for 500No. 3½mm cable clips off eBay. Not bad at £4.99 delivered and arrived in 4-days. I just have to remove all the nails now to use No.0 screws!

 

I've already got plastic bags full of little nails from previous cable clips. Any ideas what 'good' use they could be put to?

 

Ian

Link to post
Share on other sites

  • RMweb Premium

No decent ideas I'm afraid. These are masonry nails so brittle and prone to shattering, and I've put mine into the bin as I've pulled them out of their clips.

 

Brass pins are very cheap in "layout sizes" and I usually use these if I want a pin.

 

- Richard.

Link to post
Share on other sites

  • RMweb Premium

I am developing a home-made controller for my Magnorail installation. I have an Arduino Uno with a display, and a set of five push buttons representing my four reed switches and a 'start/stop' control button:

P1020810.jpg.af9619ca8800003f5597f54252773b78.jpg

 

I have written  a good sized chunk of the software for the Arduino, but hit a snag with the layout wiring to the reed switches. Essentially, the motor drive shield (sitting on top of the Arduino in the photo) consumes all of the digital I/O pins. I have built a ladder network using a series of resistors to make a simple digital to analogue converter, and this was intended to connect the four reed switches to one analogue input on the Arduino. This circuit is on the piece of Veroboard.

 

Unfortunately, this arrangement works fine on the bench but suffers from a great deal of electrical noise and false trips when installed under the layout. I have worked around many of the false trips in the software, but I get stuck when the code is waiting to see a specific switch and it sees noise representing the value of the same switch.

 

My plan now is to rebuild the controller using an Arduino Nano instead of the Uno, with a completely different motor driver circuit. This will free up all of the I/O pins I could possibly want for this project. At the moment, the motor driver circuit is somewhere in the post.

 

- Richard.

  • Like 1
  • Craftsmanship/clever 1
  • Friendly/supportive 2
Link to post
Share on other sites

  • 2 weeks later...
  • RMweb Premium

I have good and bad news to report!

 

The new prototype with its Arduino Nano and new motor driver circuit are up and running. The Arduino motor made a fair noise being driven by this circuit, especially when starting, and I have figured out how to solve this. I have altered the frequency of the PWM signal I am using to drive the motor, and shifted this up to 32 kHz, way above my threshold of hearing. Good.

 

Unfortunately, I have hit two snags with the software. One is, because my Magnorail track is so short, it is going to be hard to program visible acceleration and deceleration into movement in the small length of road available. A mate who is something of a computer guru has suggested developing an adaptive algorithm. I would want to check and respond to a reed switch whilst applying acceleration or deceleration, and I've not worked out how to start. It may be too difficult for me. Fortunately, this is only a hobby.

 

More importantly, I have managed to fill my brain with so much programming I haven't left any free space to actually think any more. I have therefore put the Arduino project aside, to restart after I have tackled and completed a few jobs around the house. I can't help thinking, it might be sensible to assemble the Arduino hardware onto the underside of the baseboard, and get the baseboard back into its alcove. I haven't run a train for ages.

 

- Richard.

  • Friendly/supportive 2
Link to post
Share on other sites

Hi Richard,

It sounds to me as though you need to forget about all this complex stuff for a good while, set the layout up and enjoy running a few trains!

I keep an old Duette (analog controller) for circumstances when I can’t even be bothered with sorting a problematic digital loco out, sometimes going back to the KISS principle, is really beneficial.

All the best,

John.

  • Agree 1
  • Thanks 1
Link to post
Share on other sites

  • RMweb Premium

Yep. Clyde Humphries (of Magnorail-Oz) has described my Magnorail as a "proof of concept" and I think this is very fair - there is a visible effect from the servo moving the chain but to my mind it's a bit low-key.

 

I do have some functional software in the Arduino, working mostly at a debug level. It sets up the servo for the bike and the car, and can use a display to tell me things I can see with my own eyes like the last waypoint passed by the car and the number of laps completed. It does many things but does not drive the car.

 

Me trying to get a finished system probably needs a fresh and larger Magnorail track, and this in a less confined location, and a partnership with someone with a natural flair for software.

 

- Richard.

  • Friendly/supportive 1
Link to post
Share on other sites

  • 2 weeks later...
  • RMweb Premium

At the end of the day, I will want an Arduino with some kind of software if only to drive the servo moving the Magnorail channel sideways. So I have put my problematic software aside and returned to the hardware side of the project.

 

This is my third version of Arduino hardware for my Magnorail installation:

DSCF1403.jpg.7c07dbfd7da0a5d0bae88e8226231c85.jpg

 

The main differences/improvements are:

  • An Arduino Nano instead of a Uno, because this is so much easier to connect to layout wiring.
  • A separate pcb instead of a shield to drive the Magnorail motor (I could be using a simple transistor here but it seems easier to buy a ready-made circuit with an H-bridge, even though the chain always runs forwards and I don't need the reversing capability of the bridge).
  • Inputs from the four reed switches using dedicated digital inputs to the Arduino instead of being combined onto one analogue input (I have built a new interface on Verobard to use the existing layout wiring).
  • A spare servo connected to emulate the servo hidden under the Magnorail roadway.

At this stage, there are only two wires between the Arduino and the layout, these being the connection to the Magnorail motor (the pink and violet wires). I am simulating the progress of the Magnorail chain around its circuit by pressing the buttons on the piece of Veroboard in the right sequence. I have also been pressing the buttons in the wrong sequence to show myself how robust the software will be in the face of electrical noise on these inputs.

DSCF1405.jpg.bbf3822d6cf4c27bd6e7d47f0cc1f525.jpg

 

The piece of Veroboard in the foreground here is my first version using an analogue input on the Arduino for five inputs and is no longer part of the system. The Arduino Uno is doing nothing; I am simply using its breadboard to hold two push buttons. The spare motor top left is from an old Epson printer. This has let me try out the system in my office where I have been writing the software. This motor runs on 12V, which is good (it's the same voltage as the Magnorail motor) but its driving characteristics are completely different, which is not so good.

 

I have let this project become an occasional activity during the last couple of weeks, and turned to sorting out old family photographs. This is fun and a welcome break.

 

- Richard.

 

 

Edited by 47137
  • Like 1
  • Craftsmanship/clever 1
  • Friendly/supportive 1
Link to post
Share on other sites

  • RMweb Premium

Things are looking up a great deal.

 

Earlier this week, I installed my new Arduino prototype (on the wooden tray above) onto the underneath of the baseboard, and connected it to the four reed switches. I used a separate analogue controller to drive the motor, and proved a great deal of the software, especially its logging and text display.

 

Yesterday morning I realised I had almost certainly destroyed the H-bridge, so I built a very simple circuit using a power MOSFET and a couple of discrete components to drive the Arduino motor. This gave me successful control of the motor, so in the afternoon I rebuilt my Magnorail project to use this MOSFET.

 

Around 5pm, the car covered a few laps under control of the Arduino, and I realised I had cracked the project. The software puts the car into its garage to initialise the system, and sends the car out for two or three laps after the press of one button. The software gives the car one rate of acceleration and three rates of braking, and sets up different exit routes from the mini roundabout. There is even a simulated gear change from first to second gear when the car sets off from a standing start on a lap. There is logging for fault-finding and tweaking, and a small text display showing debug information on one row and a user dashboard on the other.

 

The struggle is over, this is going to work :-)

 

Photos to follow of course, but at the moment the MOSFET lash-up is too fragile to let me move the layout. I can now polish up the software and build the hardware to a more permanent standard.

 

- Richard.

  • Like 1
  • Round of applause 1
Link to post
Share on other sites

  • RMweb Premium

This is my installation of an Arduino to control my Magnorail system. The Arduino is a clone 'Nano' version sitting on an expansion shield in the middle of the photo:

DSCF1447.jpg.a3bfed424782b6b35e638c8bce30058c.jpg

 

This photograph should be portrait format (the lighting will then look  more natural!) but whatever I do, the RMweb software insists on rotating it counter-clockwise.

 

Above the Arduino (i.e. "left") is a small pcb carrying a MOSFET to drive the Magnorail motor, and below ("right") is my panel of Veroboard connecting the inputs from the four reed switches. The bunch of cables exiting to the right ("top") are temporary connections for the start button and its associated LED, and the display.


The idea is to put a start button and LED on the fascia of the layout. The display will go on a control panel separate from the layout, with a duplicate start button beside it.

 

The MOSFET pcb does not have a flywheel diode to protect its transistor from back emf from the motor, so I put a diode across the motor terminals:

DSCF1435.jpg.42a18d7f08cc7151a7da2d69b5f920eb.jpg

 

Putting it here means I can't lose it or forget it if I ever try a different driver stage. I added the small capacitor too, maybe this will suppress some motor noise.

 

I am convinced, if you want to control an electric motor and it needs to go in only one direction (no reverse capability) the MOSFET is the way to go. I bought five of these boards for £5, this is cheaper than buying the transistors on their own.

 

The Veroboard panel worked out nicely and dropped in to connect to my existing layout wiring:

DSCF1436.jpg.8e060814a69a710653e79a8de7634ebf.jpg

 

This is my Meccano enclosure to protect the motor from impact damage, and the wiring to three of the reed switches:

DSCF1454.jpg.7f678554945462706c7b431d581c39dd.jpg

 

The software is still behaving itself. The car accelerates and brakes, and the servo changes its exit line from the roundabout, but I need a video to show this.

 

- Richard.

  • Like 1
  • Craftsmanship/clever 1
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...