Is there away to get a bi-directional current to work with a arduino?

Hello all
I've got a bi-directional forward & backwards DC current can you get the Arduino to work in both ways with-out using a bridge rectifier as it needs to have different colour RGB LED setup.

What is this "bi-directional forward & backwards DC current", what size is it and where is it's reference with respect to the Arduino ground? Is it a fixed current or does it change in size?

What are you trying to do?

All these matter for a detailed circuit design.

In principle however you use a resistor to turn the current into a voltage and use that voltage to alter the central bias on an analogue pin made from two equal size pull up and pull down resistors.

Is it related to this? :roll_eyes:

It's a 0 to 16V DC power it's for a HO scale railcar.
At the moment I'm just brainstorming of ways I can get the RGB LED's to work with the colours I want & not have to use 3 LED's for just 1 light, to have the 3 colours I need.

So I'm just wondering is it away to do this or not?

So I'm just wondering is it away to do this or not?

Yes it probably, but you will have to do better at saying what exactly you want.
So it seems you actually have a D.C. voltage not a current.
The simplest and safest way would be to use two opto isolators one for each voltage polarity with a protection diode on each.

I think the OP wants to power the Arduino from a power source that can be anything between -16V and +16V because it powers a model train through the rails. The Arduino drives some LEDs which may be signals attached elsewhere to the track, or maybe onboard the train.

My first question would be is an Arduino even needed? If the LEDs are onboard the train and indicate the direction of travel, this can probably be done simply, without an Arduino.

But if an Arduino is needed, then a diode bridge will need to be used to rectify the voltage. But the Arduino will need 5V. When the rail power is less than 5V, it will need to be boosted up to 5V. When it is over 5V, it will need to be reduced to 5V. A DC-DC converter which can boost the voltage up or down would be ideal.

This one claims 3-32V input. However, the diodes in the bridge will drop ~1.5V, so the circuit will only operate when the input voltage is above ~4.5V or below ~-4.5V.

Most serious railway controllers - short of DCC - would use PWM, so the "minimum" voltage should not be a concern.

BoomerAUS00:
I've got a bi-directional forward & backwards DC current can you get the Arduino to work in both ways with-out using a bridge rectifier as it needs to have different colour RGB LED setup.

Isn't that just a classic variant on an XY problem? :roll_eyes:

PaulRB:
My first question would be is an Arduino even needed? If the LEDs are onboard the train and indicate the direction of travel, this can probably be done simply, without an Arduino.

Yeah if it only was a red & white marker light setup then yeah fine but i need red, white & purple & not a lot of room for 6 LED's in the front & i've not even started with the headlight & rear markerlight yet so then 8 LED's all up in the front of a HO scale Railcar.
Not going to happen so i went with a RGB 5mm LED to get all 3 colours so now i need some sort of controller to get what colour i need.

Can you please explain in more detail how many LEDs are needed of what colours and in what conditions each led will be on. We are not all experts in model railways.

Also please post links to the controller system you are using. As already pointed out, your idea that the voltage varies between -16V and +16V may not be correct.

HO gauge are small models. How do you plan to fit an Arduino inside?

What do you mean by the bi-directional current?

This is what is needed one fits all setup just use a dip switch to change the colour that is needed.

So the dip switches set the pattern for each of the two lights at the front of the train: red, purple, white or off. The lights at the rear of the train are both red.

When the train reverses, the lights should swap, so that whichever direction the train moves, the red/purple/white lights point in the direction of motion and the red only lights point backwards. Correct so far?

Question: for the "route 71" pattern, how can you tell if the train is coming towards or away from you? Both lights would be red in either case.

Ah yes, Sydney trains used to have four lights (red/ white pairs) which identified their current route - but that was some time back. :grinning:

You could no doubt use simple DIP switches and diodes; you have not indicated what control system you are using but it clearly is not DCC - the LEDs will vary in intensity (and colour) with voltage applied.

An alternative would be to use an Arduino and WS2812 LEDs.

PaulRB:

So the dip switches set the pattern for each of the two lights at the front of the train: red, purple, white or off. The lights at the rear of the train are both red.

When the train reverses, the lights should swap, so that whichever direction the train moves, the red/purple/white lights point in the direction of motion and the red only lights point backwards. Correct so far?

Question: for the "route 71" pattern, how can you tell if the train is coming towards or away from you? Both lights would be red in either case.

Yes you are right, that's what I 1st did setup the 3 LED's & join them together with alfoil & fibre optic to give the 1 light and using a DIP switch to change the colour, but that is way to many LED's as it would be like 8 LED's just setting at the front of the railcar, as 6 for both marker lights 1 for the headlight & the last is for the red marker lights.
For the route 71 & all other routes you have the headlight on to know what it what. :slight_smile:

Paul__B:
Ah yes, Sydney trains used to have four lights (red/ white pairs) which identified their current route - but that was some time back. :grinning:

You could no doubt use simple DIP switches and diodes; you have not indicated what control system you are using but it clearly is not DCC - the LEDs will vary in intensity (and colour) with voltage applied.

An alternative would be to use an Arduino and WS2812 LEDs.

Yes it is 100% DC I can't give you the name of controller system as they run on more then 1 layout, as we have a group we go to every 2 to 3 weeks & also my own little testing loop.

PS why use WS2812 LED strips when i've get RGB 5mm 4pin LEDs that do the same thing. :slight_smile:

Not sure what "100% DC" actually means here?

PS why use WS2812 LED strips when i've get RGB 5mm 4pin LEDs that do the same thing

Because they are much easier to control. The WS2812 don’t have to be in strips, you can get 5mm ones as well. Just one data line and you can control as many as you like