help with train project

I need advice on laying out hardware I have a keypad and LCD 16 x 2, arduino mega do i use an i2c bus to connect the two units. I also need to connect the wireless XP chip and save to memory speed curve code, direction code, engine ID code.

If someone could point me in the right direction on what I need to learn thank you very much Tom

If you have a Mega 2560, you have plenty of pins available and do not need to use I2C to connect to the LCD - unless it is one already fitted with an I2C backback.

The message is - take it easy! Get the parts, start practicing with each in turn, one at a time. Learn to use the keypad interface; learn to use the LCD, learn to use the EEPROM, learn to use the wireless.

When you understand each of those, you can begin to combine them.

Hi Tom, I did a quick check and it looks like you have done most of the basic stuff from previous posts, with regard to keyboard and LCD display which is great.

What is it that you are finally trying to achieve?
Is this project a base unit to display the data from remote units mounted on locos around a layout or a remote control system to control the loco or possibly both.

It looks possible, I have a cousin building a garden railway and the loco monitoring would be an application he would like.

Tom... :slight_smile: (GWR, God's Wonderful Railway fan.)

Thanks for answering my post, I I I am trying to make a two part system,
the first is the transmitter with keypad and and wireless the keypad used to enter data to the LCD,
and arduino. By the use of the menu on the LCD to change different functions.
Such as engine speed ,engine ID number ,direction and others.
Then send to a receiver unit in the train engine by wireless and also to save certain type of data
on the train engine such as ID number.
I have tried different pinouts on the mega but the only thing I can come up with is the same pinouts for the LCD and the keypad in parallel using pull-up resistors, I've tried digital pins and the analog pins, currently the pins I'm using are the digital input output pins 2 through 13. I know for my first project this is not easy so thank you very much Tom anymore information I can provide just let me know

What electronics are in the loco? Has it a wireless receiver? Do you plan for the Arduino to send wireless commands to the loco?

I am doing this with my NGauge trains.


I'm working on I made ho train, i have to build the pcb board for the engine and one for the transmitter.
Once I get the system to work I have to make the board small enough to fit the Ho engine,
you can email me at tamacdonald tom

Hi Tom, You might want to take a look at these devices and these versions See how small they are. They have a 2.4Ghz wireless transceiver, an Atmega 328 cpu and a h-bridge for driving the motors.

I am using the H61 Deltino devices (which are physically identical to the Rx61 but are programmed as Arduino devices). I am also using one of the same devices connected to my PC as the "transmitter" that sends controls to the trains.

The Rx6x variants are programmed to respond to regular 2.4Ghz radio control equipment - but read all the details on the Deltang website.

You might also be interested in the radio controlled railway stuff here R.C. The Future Now If You Desire - Model Railroad Forums - Freerails. DavidT is the guy who makes the Deltang products. He's very helpful.

I'm just a satisfied customer.


Reply on mega 2560 pins I set the LCD to lcd(2,3,4,5,6,7,)
this works fine but the problem is when I go to pins lcd(38,39,40,41,42,43)
nothing works can anyone tell me how to set the pins up. thank tom

I'm not familiar with using LCDs - you might be better to start a new topic with a title that describes the problem. It would also be a good idea to include a copy of your code and a link to the datasheet for the LCD device that you are using.


Reply on mega 2560 pins I set the LCD to lcd(2,3,4,5,6,7,)
this works fine but the problem is when I go to pins lcd(38,39,40,41,42,43)
nothing works can anyone tell me how to set the pins up. thank tom

I don't know the LiquidCrystal interface all that well, but on the Mega, pins 2-13 and 44-46 can support PWM (pulse width modulation, which is used in the analogWrite function). If any of the pins in LiquidCrystal need to use analogWrite, they won't work with the pins you've chosen. I would recommend, doing it a single wire at a time, start with 2,3,4,5,6,7,8 which you said works. Then change one wire (such as pin 2 to pin 38), and try it again. If that works, great, go on to the next wire. If it doesn't work, then try the wire in 44-46 instead. Continue on for the remaining pins.

Thanks a lot 3536 3738 work fine 11 and 12 are still on, now all I have to do is combine the OCD code and the keypad:
code, thanks again tom