Using arduino to send many signals through only 2 lines,VCC and GND

HI !I have more than two motors on the same line.I want to control them individually.I cant remove those who are not needed,they need to stay on the line.Can I use the arduino for (or atmega standalone) controllinh them ???


My mail address is :

Moderator edit: en clair email address removed.

Given that you can't remove them or rewire them then no you can't control them individually they are on the same lines.

So what is this "thing" is it an electric train set?

Can you explain yourself better, if I understood right you have two motors that should be controlled from one output pin rights, if thats the problem you need two FET type transistor to conrtol each motor , when the pin is LOW one of the motors will operate then when the pin is HIGH the other motor will turn on

on of the fets should be p type the other n type, the n type will turn off when the pin is HIGH and the p type will turn on , please double check on this since i am not sure of this, hope it helps

Do either or both of these motors need to run backwards at all?

MalharD:
HI !I have more than two motors on the same line.I want to control them individually.I cant remove those who are not needed,they need to stay on the line.Can I use the arduino for (or atmega standalone) controllinh them ???

If you want to control e.g. multiple trains on the same rail, this requires additional signals sent over the power lines, and special electronics. Otherwise motors connected to the same supply will run together, as soon as power is switched on - you have to insert some switch (FET…) into the power line of every motor for individual control. Then connect every switch to one output pin, to turn the motors on and off individually.

Yes, you can do this by adding an Arduino and a fair bit of electronics at the motor end of the wire, without adding any additional wires. It requires two Arduinos, one back at the control point, the other at the motors.

It isn't trivial, however. It is much simpler to add a second Vcc wire to separate power to the motors, and use just the one Arduino remotely.

As the OP has not even bothered to add any extra information in 5 days I guess he has not got the language skills or the will to supply ant further information. Let's call it a day until he does.

Guys,I am very sorry for my late reply.I was grounded to use the net.

The people saying that I want to control a model railroad set are absolutely true.

I know I need to some FETs for switching.I need to develop a communication method.I also Know that there are many companies providing DCC systems,but they are expensive,I cant afford these.I will use a full arduino at control center and a Atmega328 chip In the locomotives,I can use a 7805with thwt to provide the vtg to the chip in loco

GRUMPY_MIKE is ABSOLUTELY RIGHT DrDiettrich spoke my mind.I want to do the exactly same thing.

Here i can say I have EIGHT locos in all,may be FIVE will on the track at the same time ,TWO or THREE Will run at the same time

another advantage of using the arduino is flexibility in my control.

What have you found already from your web searches?

It is something that requires a lot of knowledge to design one from scratch. This is what the system must do:-

The tracks carry the voltage but they must also carry the the control signals as well. This is normally done by modulating the control signal on the DC at a high frequency, in this case it means a few tens of Khz. Then at the train end you have to filter the large DC component of this signal and demodulate it, before feeding it into the train's processor.

It is probably easier if you do this with a standard 9600 baud serial signal.

Then you have to devise a protocol that allows multiple receivers to work on the single connection. This means some sort of address given as well as the direction and speed information in a data package. One such protocol is the DMX system, this is designed for theater lights but the same idea can be applied for trains. http://en.wikipedia.org/wiki/DMX512

There is quite a bit of electronics you need outside the Arduinos.

No doubt there are people who have done similar projects but I have not come across them before.

MalharD:
I need to develop a communication method.I also Know that there are many companies providing DCC systems,but they are expensive,I cant afford these.I will use a full arduino at control center and a Atmega328 chip In the locomotives,I can use a 7805with thwt to provide the vtg to the chip in loco

I’d think that the easiest solution is a Bluetooth network for you. BT shields are readily available, or you use an ArduinoBT in every locomotive. Don’t forget to allow the RF to reach the antennas of the BT receivers, metal cases will be problematic. Or you use an infrared control, also readily available, and possibly a net of IR senders to cover the full area.

In all other cases you’ll have build the senders and receivers for the RF communication yourself, not really recommendable for newbies to that matter.

Grumpy Mike,Before posting this question here,I asked my teacher about this.She said I have to use multiplexers and demulriplexers.I know what they are,but I don't know how to use multiplexers,how do I tell the demultiplexer Which select pins I have selected at multiplexer?

No, using multiplexers is not the way you can do it. You only have two wires to play with for communications and power, unless you uses a wireless technology for the communication. Even then you can't use multiplexers. Sounds like your teacher has only a vague idea of what they are. Basically they are the electronic version of a multi pole switch.

Here is what I thought...

Each pulse refers to a low signal,about duration 0.001 s,for this selected time ,there will be no any current/voltage in the track ,as it is a very very tiny amount of time , it won't affect the motors of running locos or any LEDs.

control center will send high pulse through the tracks,If I want to select the LOCO1 ,it will send Four pulses to tell all arduinos to get ready to be addressed,(called).If I send ONE low pulse after this ,LOCO1 will be called and ONLY LOCO1 will read further code(pulses).

BUT.... problem comes here... If the supply is off for only 0.0000001 second,ANY system(E.g.Computer,phone,etc.) will RESET ITSELF

I have limitation of free space in the loco,I cant put any batteries there.

The EEPROM is quite small to store all the Arduino on it or I can say that I don't know the size of my finished program,but it will definitely bigger than 1Kb,Blink Led sketch is of approx 1076 B >1024b=1KB

That is not a problem, capacitors can maintain the supply voltage for a short time. You problem is how to distinguish between a pulse and a logic high seen on the line as a result of it having power on it? The other problem is one of synchronising the pulses so all are agreed on the beginning.

MalharD: .She said I have to use multiplexers and demulriplexers.I know what they are,but I don't know how to use multiplexers,how do I tell the demultiplexer

Are you sure about that ? Or did she actually say modulator and demodulator ? Do you ask your teacher questions if you aren't sure you understood what was explained ?

Of course a teacher is a person too, who can make mistakes. You asking questions if whatever that teacher tells you doesn't add up can help you and that teacher find such mistake.

I think that the teacher meant multiplexers for attaching multiple channels to a single communication line. Then every connected device will receive all information, and must filter out (demultiplex) the information related to itself (its dedicated channel).

Simply pulsing the power line is not reliable, since the trains are not soldered to the rails, but can loose connection for a short time every now and then. That's why such a communication must be very, very fault tolerant. This usually means a bidirectional communication, where every device must acknowlede the receipt of valid commands, and the master must repeat a transmission until it receives an acknowledge from the addressed device. See the I2C protocol for an example. But such a bidirectional communication would require that every device is capable of drawing the power line low, what will effectively shorten the power supply - certainly not a good idea :-( It may work when positive pulses are added to the power line, incrementing the voltage for a short time, instead of pulling it low.

Commercial devices most probably inject RF, using the rails like an antenna. Then every device can have its own frequency, as used in remote control of toy cars or planes. But more probably a single frequency is used, and information is sent in binary encoded packages, which have to be decoded by every device. Then every device picks its own information off the received package. Again the I2C protocol can serve as a pattern, or (simpler) every package contains a byte for each device; then device 1 will pick the first byte off the package, device 2 the second byte and so on. Then the packages can be sent continuously, so that it doesn't hurt when a package is lost due to temporary interference (lost contact...) - every locomotive can continue running at the speed sent in the last valid package. Of course a delay must be inserted between packages, so that the devices can find the start of a new package.

Hi, There are some people who have done DCC on arduino. I just followed one of them and I have a working DCC controller using arduino. Thank you for all the help.