Jump to content
 

Battery powered/Radio controlled locos


StuartM
 Share

Recommended Posts

Well to give you a comparison, this is the program that I wrote to control my servo circuit.

The program, on start up reads the values placed in the memory and then decides if it needs to be programmed or if it needs to operate.

The program option allows the variables to be entered for the limit of servo travel and the operate option waits for an instruction from the data bus and then either carries that instruction out or ignores it if the servo is already set in that position, then the relay is set accordingly and then the code waits for another instruction, ignoring all commands not addressed to it

The program also checks continually to see if it needs to be reprogrammed.

 

I like the simplicity of basic as even a uninterested party like me can work out what's going on.

I also meant to say that the Picaxe chips also come in a 3v version, which would be useful for battery power

 

;==============================================

;SERVO& RELAY CIRCUIT V2.2 one

;=============================================

 

#picaxe 08m2

 

 

start:

 

read 1,b2

read 2,b3

read 3,b4

read 4,b5

if b5=0 then goto program

if b5=1 then goto preoperate

goto start

 

 

;=================================================================================

;programing mode

;===============

 

program:

b1=150

pulsout c.4,b1 ;centre

pause 1000

 

do

if pinc.3=1 then gosub check

if pinc.3=1 then goto cont1

pause 35

toggle c.1

loop

 

check:

pause 1000

return

 

cont1:

do

high c.1

if pinc.3=0 then goto cont2

loop

 

cont2:

low c.1

pause 1000

high c.1

do

pulsout c.4,b1

pause 100

inc b1

loop until pinc.3=1

b2=b1

write 1,b2

 

low c.1

pause 1000

high c.1

 

do

pulsout c.4,b1

pause 100

dec b1

loop until pinc.3=1

b3=b1

write 2,b3

 

b4=0

b5=1

write 3,b4

write 4,b5

 

low c.1

 

B6=1 ;TELLS THE CONTROL PANEL WHICH SERVO IT'S WORKING ON

serout c.1,n1200_4, ("END",b6)

 

goto operate

 

 

 

;=============================================================

;normal operation

;=============================================================

 

preoperate:

 

if b4=0 then relay

if b4=1 then operate

 

 

 

relay:

high c.2

 

 

operate:

serin [1000,reprogram],c.1,n1200_4,("one"),b7

if b7=0 and b4=0 then goto left

if b7=0 and b4=1 then goto sendend

if b7=1 and b4=1 then goto right

if b7=1 and b4=0 then goto sendend

goto operate

 

reprogram:

if pinc.3=1 then goto program

goto operate

 

left:

b4=1

write 3,b4

low c.2

for b0 = b3 to b2

pulsout c.4,b0

pause 50

next b0

b8=1

goto sendend

 

 

right:

b4=0

write 3,b4

high c.2

for b0 = b2 to b3 step-1

pulsout c.4,b0

pause 50

next b0

b8=1

goto sendend

 

 

sendend:

b8=1

serout c.1,n1200_4, ("done",b8)

pause 50

serout c.1,n1200_4, ("done",b8)

goto operate

Link to post
Share on other sites

Thanks for that Stuart,

 

Its always interesting to see how others do things.

 

Edit to add....

 

I've been reading more about Picaxe. Nobody seems to make anything like the Deltang products but there doesn't seem to be any technical reason why not.

 

But it would probably not be very difficult to write a piece of software that converts Picaxe basic to Arduino C++ (and it would really get up the nose of the C purists :))

 

...R

Edited by Robin2
  • Like 1
Link to post
Share on other sites

Hi,

 

There is little difference in the picaxe basic or the arduino version of c (or most other small microprocessor languages), other than the syntax. The major difference here in the 'appearance' of the servo programs that you have both shown is the arduino has numerous comments, and the real servo control is hidden away in the Servo.h file.  I'll try and find my old c version of a similar thing, not that it was any better, but maybe different. It was written using the ccs c compiler (for the pic). You have to buy that, but is optimising, and interesting in a 'geeky?' way to see how it produces the assembler code. The free Pic c compiler is not optimising, nor is the free arduino. I expect both programs could be made smaller and quicker in operation, but if it works, that is probably good enough.

 

I've not shown any of the setting up of the particular chip that is required if using a 'raw pic' as opposed to one with boot loader and in-built libraries. Also, of course, I've defined the pin numbers as more meaningful names, and there has to be a fair bit of understanding on how to set up interrupts and other trickery in the raw pics (similar with Atmel and others, too)  but I don't see that much difference between this version of 'C' or 'Basic' (fwiw, 15 years or so ago I used something horrible, called 'PicBasic', iirc. It was very, very flaky.)  The following is from January 2005

 

   
main() {
      init();
         getspeed();
    highsw=false;
 stepi=1;step4=1;kk=stepi;
 highp=254;lowp=2;
 
loop:
    output_high(spare);
    if(!input(swit)) goto swlow;
swhigh:  //<<<<<<< counterclockwise hard over
    if(!input(speed)) setspeed();   //!!!!!
    if (highsw==false)goto changeup;
   output_low(relay1);
    step4=highp;
    highsw=true;
    goto loop;
swlow: //>>>>>>>> clockwise hard over
     if(!input(speed)) setspeed();   //!!!!!
    if (highsw==true)goto changedown;
    output_low(relay0);  //relay0 closed
    step4=lowp;
    highsw=false;
    goto loop;
changedown:  // move from clockwise to ccw
   output_high(relay0);
   output_high(relay1);
   output_low(spare);
    delay_ms(dell);
 step4=step4-kk;
 if(!input(speed)) setspeed();   //!!!!!
 if (step4>lowp) goto changedown;
 highsw=false; 
    goto loop;  
changeup: //move from ccw to clockwise
   output_high(relay0);
   output_high(relay1);
   output_low(spare);
 delay_ms(dell);
 step4=step4+kk;
 if(!input(speed)) setspeed();   //!!!!!
 if (step4<highp) goto changeup;
 highsw=true; 
    goto loop;  

 

the full program works with an ordinary servo, the pot connected to an ad converter within the pic. In tests I could get full swing in less than three seconds (I think it was well under that, can't remember,) or over 24 hrs (but I never stared at it that long.) it also switched a couple of relays). Somewhere I have the built version - I need to make some more when I get around to wanting to operate my track.

 

Now, completely off topic - 45 years ago I was programming an IBM 1130 (took an air conditioned room, cost over a hundred grand, punched cards, etc.) It had 8K of memory. The language was Fortran. In that version of Fortan, variable names had to be less than four characters, and integers were variables beginning with letters 'I' through 'N' - hence my 'KK' counter! Old habits, and so on. :rolleyes:

 

Best wishes,

 

Ray

Link to post
Share on other sites

I remember being on a college placement in the computer dept of some business that had just taken delivery of a new data storage unit, it was the size of a fridge and had the vast memory of 1meg, young people today don't know their born.

 

Anyhoo back on topic

Below is a photo I took when making my BPRC test train.

The picaxe and the radio circuit are sitting atop of the 6AAA battery's hidden inside a 9V PP3 battery, once removed from the can the battery's could be laid on the floor to create more space.

As you can see, the whole lot did not quite fit into the ngauge body shell, however the 00 gauge model sitting behind it for comparison would offer no such problem

 

The second photo shows the test train, with the circuit which includes the PIC, the L293D motor driver, the radio circuit and the voltage regulator plus on/off switch

 

The third photo shows the circuit laid against a GraFar Mk1 for size comparison.

 

I think a DIY system like this would work for gauges of 00 and above but in ngauge, then probably a professionally designed and made product like the Deltang is realistically the only option, although battery size is always going to be an issue until a chassis shaped battery is made

post-10866-0-78248400-1372494686_thumb.jpg

post-10866-0-29026300-1372495320_thumb.jpg

post-10866-0-66188100-1372495337_thumb.jpg

  • Like 2
Link to post
Share on other sites

Very interesting Stuart,

 

What radio module did you use? None of the ones I have seen in my Picaxe searches have been that small.

 

What is the second chip? and which is the Picaxe?

 

I presume some of the Picaxe chips can operate at 3volts in which case a much smaller battery would do - the equivalent of one of the AAA's for instance. There are also SOIC picaxe chips which would be much smaller yet still (I think) hand solderable.

 

...R

Link to post
Share on other sites

I've just got a Deltang TX 21 and RX 60 set up but havnt built it yet. I found a small 7.4 battery and now need a charger .I will put it in an 00 brass Y6 tram loco I am building .It is going to have a  modified Bachmann Underground Ernie One power truck which runs very smoothly and quiet and draws little power  and leaves the interior empty .Jury rigged with an with an old infra red helicopter 3.7 v battery and board  it pulled 4 wagons ,all I had at hand though will probably do more on 7.4.I will also try a more powerful battery like an 11 volt in other locos .I consider this is the future as its the logical step and already feasible .Not sure about sound yet but I am sure it will be solved by other means than DCC decoders and probably has already .All exciting stuff .

Edited by alfsboy
  • Like 1
Link to post
Share on other sites

Very interesting Stuart,

 

What radio module did you use? None of the ones I have seen in my Picaxe searches have been that small.

 

What is the second chip? and which is the Picaxe?

 

I presume some of the Picaxe chips can operate at 3volts in which case a much smaller battery would do - the equivalent of one of the AAA's for instance. There are also SOIC picaxe chips which would be much smaller yet still (I think) hand solderable.

 

...R

I bought one from Maplins several years ago, but it looks like the one I bought has now been superseded by a new model

http://www.maplin.co.uk/rf-transmitter-receiver-and-transceiver-modules-267236

 

The picaxe is the small 8pin chip and is an 08m

The second chip is a L293D motor driver

 

At the time I made this model there was only a 5v version of the 08m available

now there is a 3v smt version

 

I don't know what a SOIC chip is

 

Stuart

Link to post
Share on other sites

  • RMweb Gold

Hi Robin

 

I took an look at your posting and linked documents from the Arduino site. Thanks for that, most interesting.

 

I have also had a couple of email exchanges with Mr Deltang and thought that there was a lot of possibilities with his technology. My problem is that I want the system to work like DCC in terms of how it operators. I want to be able to have multiple handsets and multiple (though not a huge number) of locomotives. So the 12 loco option works fine, but I wanted to get more than one hand set. Turns out that this might be a possibility, Mr Deltang considered that it would be possible to link a second transmitter to be a slave and then communicate to a second loco via the first. The other options I thought of was to connecting the Deltang transmitter to a PC (or probably a Raspberry Pi and use my existing DCC handsets. As I use the MERG DCC system I can connect these handsets via CBUS so their controls get picked up by JMRI, in theory, it ought to be possible to then get JMRI to communicate to the Deltang and control the locos.

 

David

Link to post
Share on other sites

Hi David, and welcome to this subject.

 

Now that I have figured out how to make the Deltang modules work as an Arduino device (DelTino) I am in the process of developing my own train control software to use them. I expect it will be able to have about 100 locos provided only about 12 or so are actually moving at any one time. The others will be treated as "parked" and could be "unparked" at any time (provided not more than 12 (say) are unparked at any one time. The operating locos will be able to send data back to the PC (for example battery voltage) but other stuff if you can conceive of it.

 

I also plan to incorporate a small web server facility within my PC program so that trains could be controlled from smart phones (or similar) using the browsers in the phones. This is pretty easy to implement.

 

If you have space in your loco for a micro SD card (or similar) I believe it would be possible for the onboard DelTino to control sounds from files stored on the SD card. Personally I'm not a fan of onboard sound even in larger scales - my trains are NGauge. I am planning to have under-baseboard sound but that will be separate from the DelTinos.

 

This software is being planned for my personal use but I will probably make it available once it is presentable. The PC stuff is being written in JRuby (Java based) so it should work on any PC.

 

...R

  • Like 2
Link to post
Share on other sites

  • 4 weeks later...

A small contribution from me, a eureka! moment occurred to me while on holiday.  To avoid the cost of converting all my locos I realized that a 'dual standard' approach is possible for mine and probably many other layouts.  Tender engines and tank engines with pony trucks will operate conventionally, although modified to all-wheel pick up to ensure smooth running.  Since these can be confined to the main lines, conventional sectional control will not be too complex, they will after all, be following block regulations.

 

0-6-0 tank engines will be rebuilt as battery + radio control.  These can potter about on overgrown, rusty sidings while the expresses and long-haul goods trains fly past, and venture out onto the main lines to serve as bankers or pilots.

Link to post
Share on other sites

  • RMweb Gold

A small contribution from me, a eureka! moment occurred to me while on holiday.  To avoid the cost of converting all my locos I realized that a 'dual standard' approach is possible for mine and probably many other layouts.  Tender engines and tank engines with pony trucks will operate conventionally, although modified to all-wheel pick up to ensure smooth running.  Since these can be confined to the main lines, conventional sectional control will not be too complex, they will after all, be following block regulations.

 

0-6-0 tank engines will be rebuilt as battery + radio control.  These can potter about on overgrown, rusty sidings while the expresses and long-haul goods trains fly past, and venture out onto the main lines to serve as bankers or pilots.

 

Ie. let the heavy/fast trains momentum gloss over any track problems and use the short wheel base (slow/low enertia/poor pick up) locos converted to battery/radio to pilot and shunt.

 

Operationally this sounds quite interesting AND saves money.

Good thinking.

 

 

Kev.

Link to post
Share on other sites

Sounds like a good plan. Also the battery life should be good for the shunters which are only used intermittently, whereas the long running mainline locos will run off the track so battery life for them will not be an issue.

 

Frank

Link to post
Share on other sites

Developing this further, the s&c on the main lines will be live frog, but the sidings etc. can make do with old reused insulfrog.

 

The shunters can have small motors with high gear ratios, 20 scale mph max. is all they will need.

Link to post
Share on other sites

I like the general idea but I'm wondering if your use of the word "will" means that the layout has not yet been built. If that's the case I believe it will be worth considering whether the convenience of not needing any track wiring would justify the investment in total BPR/C.

 

...R

 

 

 conventional sectional control will not be too complex

Link to post
Share on other sites

Robin,

 

You are correct to assume that my layout is still under construction.  I have not done a cost - benefit analysis to determine which system would be cheaper, however I do have locos and controllers from previous layouts.  This give me a development path, I can get something running the old way, then work through the locos from small to large as time and funds permit.

 

If i was starting the hobby as a total newbie with no equipment the foot might be in the other boot.

 

Steve.

Link to post
Share on other sites

Steve, that makes a ton of sense.

 

May I suggest that the next thing you do is convert one of your locos to BPR/C so you get the full experience (even on a few bits of setrack) before you make a whole load of other decisions.

 

...R

Link to post
Share on other sites

A small contribution from me, a eureka! moment occurred to me while on holiday.  To avoid the cost of converting all my locos I realized that a 'dual standard' approach is possible for mine and probably many other layouts.  Tender engines and tank engines with pony trucks will operate conventionally, although modified to all-wheel pick up to ensure smooth running.  Since these can be confined to the main lines, conventional sectional control will not be too complex, they will after all, be following block regulations.

 

0-6-0 tank engines will be rebuilt as battery + radio control.  These can potter about on overgrown, rusty sidings while the expresses and long-haul goods trains fly past, and venture out onto the main lines to serve as bankers or pilots.

This was my way of thinking with the LNER tram loco .Its  got a small wheelbase and will always be problematic though the Underground Ernie  motor truck does work very well .Its also worked really well in a Athearn CF7  .I fancy an H0 garden railway ,not very permanent and again it works a treat .I ran it on track without any fish plates and it worked fine .I am now working on switches for the battery and a power plug .Both will fit under the fan cowlings on the long hood and as they just pop out the solution to the charging plug problem is at least solved on that model.The 7.4  lipo  balancing charging plug is a bit large .Any smaller versions available ?.My wrecked foam helicopter had a neat switch and tiny charger socket that was as elegant as light and would do a treat for 3.7 lipos but not for clunky 7.4's .

Martin

Link to post
Share on other sites

I see several 'trailblazers' from the Freerails forum here and just wanted to spread the RC word on a UK site -

 

My interest in RC OO guage is related to a proposed garden railway where I will have the space to run loooong trains. RC will allow virtually no track maintenance or connection problems.

 

To this end I have used the excellent Deltang Rx60 receiver and 3 x 3.7 Li-ion batteries configured for 11.1 volts in a Hornby West Country loco (well tender actually) and Tx2 transmitter module built into a test case.

 

The Rx60 comes with 4 wires attached - 2 for battery and 2 for motor, so it is just a case of selecting suitable batteries and we're away .... :sungum:

 

The video is on other forums but if you have not seen it ...

 

Next to get the Deltang treatment will be a Bachmann CEP, Hornby 5Bel and Rebuilt Merchant Navy .... Keep the info coming guys - this is the future ...

 

Thanks .. Andy

Link to post
Share on other sites

  • 2 weeks later...

May I share with members the system that I have been using on my outdoor 7mm DC layout for the past 10 years or so?


I use a home - built solid state inertia controller which has four basic operations: accelerate, decelerate, direction 1, direction 2. Direction can only be switched when speed is at or near zero. This controller is coupled to a radio control receiver taken out of a cheap toy r/c car, the interface being through DIL reed relays. The transmitter unit has only two two-way switches and has more than enough range to control track voltage and direction down the 20 metres or so of my garden. The receiver is battery powered and sits on the inside wall of my shed, with a wire through to an external antenna. The connection from receiver to controller is via standard multi pin D-connectors.


Not quite the same as true on-board radio control, but provided the track is kept clean then it works just as well!


 


Graham, North Yorkshire

Link to post
Share on other sites

May I share with members the system that I have been using on my outdoor 7mm DC layout for the past 10 years or so?

I use a home - built solid state inertia controller which has four basic operations: accelerate, decelerate, direction 1, direction 2. Direction can only be switched when speed is at or near zero. This controller is coupled to a radio control receiver taken out of a cheap toy r/c car, the interface being through DIL reed relays. The transmitter unit has only two two-way switches and has more than enough range to control track voltage and direction down the 20 metres or so of my garden. The receiver is battery powered and sits on the inside wall of my shed, with a wire through to an external antenna. The connection from receiver to controller is via standard multi pin D-connectors.

Not quite the same as true on-board radio control, but provided the track is kept clean then it works just as well!

 

Graham, North Yorkshire

Hi Graham, thanks for sharing your version of BPRC.

Just to clarify a few things......

Where you say "This controller is coupled to a radio control receiver" do you mean transmitter?

and where you say "The receiver is battery powered and sits on the inside wall of my shed" and "The connection from receiver to controller is" etc

forgive my ignorance but I'm not quite understanding the setup, is the loco powered through the rc or the track?

Link to post
Share on other sites

Hi Graham, thanks for sharing your version of BPRC.

Just to clarify a few things......

Where you say "This controller is coupled to a radio control receiver" do you mean transmitter?

and where you say "The receiver is battery powered and sits on the inside wall of my shed" and "The connection from receiver to controller is" etc

forgive my ignorance but I'm not quite understanding the setup, is the loco powered through the rc or the track?

Stuart, the loco is still powered from the track. The control unit is remotely controlled and stays in place, connected to the track circuits through normal switches. It just means that I can wander about with a hand-held controller. In every other way it is a traditional dc system.

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...