Wiring help with ULN2803a transistor array

Are you building a cockpit, planning to build one or just dreaming, this is your cockpit builder meeting point

Moderators: russ, Ralph

Message
Author
Kaellis991
Posts: 581
Joined: Mon Sep 07, 2020 8:49 am

Re: Wiring help with ULN2803a transistor array

#11 Post by Kaellis991 »

jph wrote: Mon Jun 20, 2022 2:02 pm Presuming the top 2 diagrams are electromagnets and the lower two green round things are pushbuttons then no.
It appears that each pushbutton is connected to the HV side supply then to the electromagnet then to the open collector Darlington driver output.
Nothing will happen until you signal the ULN driver to turn on. That is a one way only process from Arduino to ULN input. The ULN input channels control the ULN Darlington Output Driver - Open Collector. There is no signal path back from the Darlington output to the Arduino.

IF the driver output is activate from the Arduino PRIOR to pushing a button then, if there is an mechanical latch with the electromagnet and pushbutton, it will latch as the driver stage is active. Without that signal FROM the Arduino FIRST though it wont.


IF it is as I presume - as I say above - then you could set the ULN output active by simply setting a logic 1 on the Arduino pin that corresponds to that ULN channel. The system is then ready to operate and latch. The is no communication of the push button state to the Arduino though.

You could also simply connect the push button to an Arduino input (so it is not connected electrically to the solenoid) and take the solenoid directly from the HV line to the ULN Darlington Collector. When the Arduino sees the push button pressed it can then activate the solenoid to latch. Whatever condition this is designed to operate in / and release in - can then be coded as you please. That way the Arduino is fully aware of the state of both the button and the solenoid and has full control over solenoid operation.
Joe
Joe,

Did I just have the switches in the wrong place and they should be between the Arduino and the transistor?
I removed the lights to simplify....

Actually I dont think I really comprehend what I am doing here....
image.png

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Wiring help with ULN2803a transistor array

#12 Post by jph »

Hi Kirk, That would work providing you set the arduino pins high when AP is actually possible to be enabled, and low when a situation arises that will disconnect the AP.

sort of - q. ? - can we enable AP - are all aircraft conditions met ? - if so set the arduino output pin high (this is the pin that connects to the the push button in your diagram.

Then when you press the button, if the hardware unit you have works as I think it does then it will latch on.

When a situation arises that would cause AP disconnect simply take the Arduino pin low.
Joe. CISSP, MSc.

Kaellis991
Posts: 581
Joined: Mon Sep 07, 2020 8:49 am

Re: Wiring help with ULN2803a transistor array

#13 Post by Kaellis991 »

jph wrote: Mon Jun 20, 2022 4:27 pm Hi Kirk, That would work providing you set the arduino pins high when AP is actually possible to be enabled, and low when a situation arises that will disconnect the AP.

sort of - q. ? - can we enable AP - are all aircraft conditions met ? - if so set the arduino output pin high (this is the pin that connects to the the push button in your diagram.

Then when you press the button, if the hardware unit you have works as I think it does then it will latch on.

When a situation arises that would cause AP disconnect simply take the Arduino pin low.
Joe,

Excuse me in trying to simplify this using layman's language...
If I understand this transistor correctly, sending 5V from the Arduino pins to the #1 and #2 Darlington input pins by closing the switch connects the magnet ground wires at Darlington pins 17 and 18 to the ground on the power supply?
For the life of me, if that is correct, I just cant see how the transistor makes that connection. What is the pathway of that grounding signal...through the arduino ground pins?

In real life an autopilot is disconnected by excessive control movements or other external forces. However, that will not be part of my setup.
The only way to turn off the autopilot will be to press the bottom of the toggle switch which will pull the top of the toggle away from the magnet. The momentary switch plunger will then spring back out to it's normal position and disconnect.
I think then it will disconnect the 5v going to the darlington pins from the Arduino pins and open the circuit (i.e. disconnecting the magnet ground wire from the power supply) causing the magnet to de-energize.

Kirk

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Wiring help with ULN2803a transistor array

#14 Post by jph »

I have attached the ULN datasheet, if you look at page 3 there is a schematic of a complete stage. (any one of 8)
Think of it basically as a single transistor - just to get your head around it - I presume you are familiar with an NPN transistor operation ?

Think of it like this -the arduino pin connects to the 'base' of the transistor, the emitter is grounded and the collector is not connected to anything at all (called 'open collector output')

A transistor is a basic current amplifier and the current flowing through the collector emitter junction is directly proportional to the current flowing through the Base Emitter junction multiplied by the HFE (The gain) ... in other words, a small amount of current flowing through the base emitter junction enable a large amount of current to flow through the collector emitter junction.

If you connect a light bulb to a voltage supply, and the other side of the bulb to the ULN Darlington pin (which is the collector of the transistor) then to enable current to flow from the lightbulb supply to ground(the emitter) there needs to be a current from the base to emitter.
You can consider the base isolated from the collector. The only common pin is the emitter which is actually grounded.
So when you apply 5v to the base (the ULN input pin) that causes a current flow in the base emitter junction of the darlington pair (which is just a VERY high gain transistor to all intents and purposes and is either on or off). The current in the Base emitter causes the Collector Emitter junction to conduct and now your lightbulb is connected to ground via the collector emitter junction and the bulb O :D ooooooooo. 'he go bright'

Datasheets are your friend ;)

uln2803a.pdf
(298.56 KiB) Downloaded 81 times
Joe. CISSP, MSc.

Kaellis991
Posts: 581
Joined: Mon Sep 07, 2020 8:49 am

Re: Wiring help with ULN2803a transistor array

#15 Post by Kaellis991 »

jph wrote: Mon Jun 20, 2022 5:41 pm I have attached the ULN datasheet, if you look at page 3 there is a schematic of a complete stage. (any one of 8)
Think of it basically as a single transistor - just to get your head around it - I presume you are familiar with an NPN transistor operation ?

Think of it like this -the arduino pin connects to the 'base' of the transistor, the emitter is grounded and the collector is not connected to anything at all (called 'open collector output')

A transistor is a basic current amplifier and the current flowing through the collector emitter junction is directly proportional to the current flowing through the Base Emitter junction multiplied by the HFE (The gain) ... in other words, a small amount of current flowing through the base emitter junction enable a large amount of current to flow through the collector emitter junction.

If you connect a light bulb to a voltage supply, and the other side of the bulb to the ULN Darlington pin (which is the collector of the transistor) then to enable current to flow from the lightbulb supply to ground(the emitter) there needs to be a current from the base to emitter.
You can consider the base isolated from the collector. The only common pin is the emitter which is actually grounded.
So when you apply 5v to the base (the ULN input pin) that causes a current flow in the base emitter junction of the darlington pair (which is just a VERY high gain transistor to all intents and purposes and is either on or off). The current in the Base emitter causes the Collector Emitter junction to conduct and now your lightbulb is connected to ground via the collector emitter junction and the bulb O :D ooooooooo. 'he go bright'

Datasheets are your friend ;)


uln2803a.pdf
Datasheets are like having an american trying to understand a heavily accented scottish bloke. The alphabet and the words used are the same, but it's still ....what did you say?

So the basics are....when the Base-Emitter side gets zapped, the Collector-Emitter side starts conducting the ground side signal and provides a connection between the power supply and the ground terminal of the magnet.
How does that ground signal get from the power supply to the magnet(s). From point A to B in this diagram?
image.png

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Wiring help with ULN2803a transistor array

#16 Post by jph »

There comes a time when, if the info isnt clicking, that you just have to accept that doing A causes B :)
The pathway you note is from collector to gnd of the output darlington pair as the ground is common to the whole circuit. The gnd on the arduino is also connected to the gnd on the uln which is connected to the Darlington emitter. And the lord sayeth, a circuit shalt thou make, and verily! .. it was made, and it was good and the people were happy, (Corrinthians 24, Man UTD 6)

and Adam got electrocuted. .. no, i think that was another datasheet :?:

And yes, placing a logic 1 on the input allows the output darlington pair to conduct a high voltage and up to half an amp current per pin. The two sides only share the same gnd, as all parts of any cicuit usually do. You can think of it as a solid state relay if it helps?
Joe. CISSP, MSc.

Kaellis991
Posts: 581
Joined: Mon Sep 07, 2020 8:49 am

Re: Wiring help with ULN2803a transistor array

#17 Post by Kaellis991 »

There are many things I have to accept in life...just ask my "better" half.

So I think I'm good to go with my circuit build and hopefully I will not blow up any arduinos in the process.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Wiring help with ULN2803a transistor array

#18 Post by jph »

;)
Yes, looks perfectly safe from here in Portugal :D
Joe. CISSP, MSc.

Kaellis991
Posts: 581
Joined: Mon Sep 07, 2020 8:49 am

Re: Wiring help with ULN2803a transistor array

#19 Post by Kaellis991 »

I have been away from my cockpit build for a while and I am finding that working with these electronic circuits is a perishable skill...especially for a newbie.
Now it''s time to try to finalize my autopilot / landing gear lights using the array.
Since it's been so long since I looked at this I started over with a new circuit diagram using my Leonardo.

I'd appreciate some feedback on this diagram.

The basics are that I have a 14v power supply to drive the (4) gear lights and the (2) magnets. I've hooked up the power to the magnets and the lights directly and all is good.
But now I need to add the Arduino to the mix. I am really confused right now about how the switches, the magnets, AM code and the sim integrate with each other.

In the pictures earlier in this post you can see the autopilot with the magnets that keep the two momentary switches closed when the magnets are energized.
Can you help me with the logic of this and the wiring diagram? Here is what I understand is to happen but I am probably way off base.
Let's concentrate on the two switches for the autopilot.

1. Do the momentary switches provide an input to the arduino which AM will read? Are those switches connected to GND and a pin on the arduino as shown?
2. If the switch is closed does AM read a high output on pins 6 or 7 and then writes to the dataref / command in Xplane to switch on the autopilot in the sim?
3. Does AM then at the same time send a high output to pins 12 and 13 to signal the array to connect the GND side of the magnet circuit or does AM read the dataref in the sim and use that to activate pins 12 and 13?

I know this should be simple but this has my head spinning in all directions.

Kirk

image.png

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Wiring help with ULN2803a transistor array

#20 Post by jph »

1. Do the momentary switches provide an input to the arduino which AM will read? Are those switches connected to GND and a pin on the arduino as shown?
2. If the switch is closed does AM read a high output on pins 6 or 7 and then writes to the dataref / command in Xplane to switch on the autopilot in the sim?
3. Does AM then at the same time send a high output to pins 12 and 13 to signal the array to connect the GND side of the magnet circuit or does AM read the dataref in the sim and use that to activate pins 12 and 13?
Hi Kirk
1. yes
2. when switch closed AM reads a LOW as they are normally read as HIGH when inactive due to the internal WPUs. When the switch is closed the port pin sees a LOW.

I presume these are 'real' switches that you operate yes ?
If so, and the electromagnets hold the switches depressed when AP active then what you say sounds right - providing all the data is available and accessible to you. I would not have thought that the sim is aware of the electromagnets - only the AP engaged, which you can use as the energising signal.

By using the ap engaged to energise the electromagnets the sim logic should operate correctly so in the event of an ap disconnect via the aircraft systems the switches will be release automatically.


Joe
Joe. CISSP, MSc.

Post Reply