Notifications
Clear all

Introduction  

  RSS

Runutral
(@runutral)
Active Member
Joined: 3 months ago
Posts: 13
2020-03-18 12:30 am  

I am a Ruminant physiologist, that have been programming in different languages since the 1960, started with main frames and than to PC with floppy disks, etc, etc. Have been programming a dairy cow model, which used feeds as input, and resulted in prediction of milk production and composition, such fatty acids composition based on biochemical equations. I am a Dutchman, that lives in the USA. I recently started to program in Arduino IDE. I have been a model railroader for many years. Run a indoor layout, with a 1k computer programmed in mnemonics in the 1970's, that could run 25 locomotives. Now I have a garden railroad with about 700 feet of track. I wrote a program and built the electronics to change routes or direction. Trains run on batteries. My latest project is to have an Arduino mega run a Arduino nano located in the loco remotedly, that makes it possible to have that loco do switching by itself.  Info is number of cars put on siding, and cars located at industries. Program sort it out which car goes where and is picked up. The program should runs by itself.


Quote
Runutral
(@runutral)
Active Member
Joined: 3 months ago
Posts: 13
2020-03-28 12:33 pm  

I have the following question. I run an arduino mega as a remote, and a arduino nano as a receiver in one of my locomotives. Communication is by 2nRF24's. I will start the loco from the mega. When I want the loco to stop I have two options: 1. A sensor sees the loco and signals the mega and the train is stopped, or 2. the nano has a reed relay and sees a magnet and stops the loco. However the mega is giving orders to move while the nano wanted to stop. Can I get info from the nano back to the mega when it sees a stop. If I can use that it solves the problem of having to wire a lot of sensors to the mega and just one reed relay attached to the loco and magnets on the track, which I can easily move if I want or have to the get it to work properly . Thanks for advice


ReplyQuote
Spyder
(@spyder)
Prominent Member
Joined: 12 months ago
Posts: 751
2020-03-29 6:49 am  

@runutral

Lotsa trains here. Yours sounds very cool 👍 

So, to avoid giving you a specific answer, I want to preface this by saying that I have no idea what I'm talking about.

That being said, both the Mega and Nano have I2C and TX/RX pins, as well as input pins. It would seem to my noobie eyes that one might communicate by either TX/RX or I2C, then connecting the reed switch to the inputs of the nano and have the nano send info to the Mega that way

On the other hand, I could be completely wrong 🤫 

I would like to add tho, that those reed switches are a bit testy. VERY fragile indeed. I broke 2 of them before I finally got this to work properly...

 


ReplyQuote
Runutral
(@runutral)
Active Member
Joined: 3 months ago
Posts: 13
2020-03-29 12:41 pm  

@spyder

Thanks for your answer. What I was wondering was; are the 2nRF24's that I use to communicate between the mega and the nano capable of sending messages both ways. If so than I probably can incorporate something in the IDE sketches of both, that makes it work. Loco Sound makes a reed relay that seems more  robust, putting it in the loco seems to work for their system, where they use it for station stops, etc.


ReplyQuote
Spyder
(@spyder)
Prominent Member
Joined: 12 months ago
Posts: 751
2020-03-29 12:59 pm  

@runutral

Bill recently did a video on the nerf's

Also, after I got the reed finally installed without breaking it, I hot glued goo all over it

It's not breaking now

And if it does I'll probably have to make a new one cuz the hot air blower would probably melt the plastic too


ReplyQuote
Runutral
(@runutral)
Active Member
Joined: 3 months ago
Posts: 13
2020-03-29 1:30 pm  

Thanks, I will look at the video, it might solve my problem and avoid a lot of wiring of sensors or reed relays


ReplyQuote
Runutral
(@runutral)
Active Member
Joined: 3 months ago
Posts: 13
2020-03-31 1:16 am  

@spyder

Spyder, I looked at the video and it seems that it is possible to send Arrays back and forth over the nR24's, which means I would be  able to use a reed relay on the loco and magnets on several places on the track as a signal for stopping the loco. 

This brings me to my next question. Although G gauge locomotives are "big", the one I am using is a relatively small one. Now I am puling  a car with the receiver print and battery pack behind the loco, but I do not like that, and want every thing in the loco, if possible. It is always mentioned in video's that there is a separate battery for driving the motor and one for the arduino, etc. I have to hook the same battery pack also up to the motor, because  I have no room for two battery packs. If I use a buck converter that provide 5V to the arduino nano and adapter for the nRF24, would interference from the motor still be a point.


ReplyQuote