News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Forum Space for engineering questions

Started by Peter Truman, Aug 20, 2023, 01:01 AM

Previous topic - Next topic

Peter Truman

Hi - do we have an appropriate place on the forum in which to ask some engineering questions?

I'm trying to develop a robust, unbreakable digital input that will be valid at both 12 and 24v - my initial design used a MAX22193
- works fine with a field voltage of 24v but would not give me a valid output at anything below 22.8v (despite the support people telling me it should work)

The problem is, I don't know if what I'm building will be installed in a truck (12 or 24v) or in a panel (24v only)

I thought I might do it with discrete parts - like this



But I'm reluctant to commit to a PCB before I'm sure - does anyone know the right way to do this? (Inputs will be simple buttons and switches)

Thanks
Peter



Peter Truman

Sorry - should have mentioned, the input side of the circuit uses a PCA9535DWR IO expander chip/ Schematic attached.

trastikata

#2
If you need a voltage level shift only at inputs I'd use a simple BJT buffer/level shift with resistors and clamping diodes at the base.

BUFFER.jpg


See_Mos

The original circuit will work just fine if you replace the zener diodes with 2V7 or 3V3.

The data sheet shows the high input level as 0.7 * VDD, 3V3 * 0.7 = 2V3 so I would use 2V7 zener diodes.

The response times will be a little slow but with switches as input that is just what you want.

If the environment is electrically very noisy, as in welding applications, or the wires to the switches are very long or if there is a danger of wiring faults or cable damage I would use opto-isolators. 


rick.curl

#5
Trastikata- You circuit will work perfectly well, but there my be a simpler way.
It seems to me that you could take the input protection circuit you used directly into the expander input.  Note that those are Schottky diodes- not zeners. Schottkys are necessary to insure that they conduct before the substrate diodes do.
It's also interesting to note that the spec sheet for the expander says the input clamp diodes are good for 20mA- but I don't trust them.  In my opinion it's a bad idea to forward bias the substrate diodes.
As an absolute minimum, you should be able to do nothing more than insert a current limiting resistor between the 12/24 source and the expander input- but I think that would be bad practice.
   
-Rick

trastikata

Quote from: rick.curl on Aug 20, 2023, 03:29 PMTrastikata- You circuit will work perfectly well, but there my be a simpler way.
It seems to me that you could take the input protection circuit you used directly into the expander input.

I missed the second post with the port expander and thought he wants direct digital level shifter.


Peter Truman

Thank you all - that is really useful info.

I'm just trying not to commit to the PCb unless I'm confidant that it will work as expected. Not interested in particularly fast response time in this application and I can't really use the suggested DIS, since I only have I2C available (long story) but it's really good to know about them.

Many thanks 0 I think I might go straight to the Port Expanded as suggested by Rick

Cheers
Peter

Peter Truman

So - overall, as I understand it - the attached would be suitable for what I'm trying to do?

david

Just make sure you can't have a 26V input signal when the 3.3V circuitry is powered down.  I've seen several instances where drive signals have conducted through clamp diodes to Vdd and powered up "inactive" circuitry - usually with unpredictable results.  Even pulsed signals are neatly rectified, filtered and applied to Vdd by the existing circuitry.   The 3.3V regulator may not be thrilled either.
Ideally a clamp to ground would be preferable to dumping in to the supply, for example a single 3.3V zener to ground, but just check that this will be fast enough as zeners can be a bit slow if not already slightly conducting.

Cheers,
David

ken_k

Truck wiring can be brutal on electronics, I once worked on circuitry for road train style trucks, big spikes.
See_Mos suggested opto couplers, that would be my choice.
Something like a
https://au.mouser.com/datasheet/2/678/av02-0753en_ds_acpl-224-244_2017-06-14-1827881.pdf
The bidirectional LED's mean regardless of the input polarity the device works and tends to protect itself as only the maximum forward conduction voltage of one LED will be experienced at the IC input.
Very good noise rejection as two wires can be run to the signal source connect one wire to ground and one to the test voltage; polarity.. don't care!
Micro is galvannically isolated from all nasty noise and spikes. Very slow ok for switches and low frequency inputs.

rick.curl

Peter- your circuit looks fine. David brings up a good point, but considering the 10K input resistors it is unlikely to cause a problem.  Ken mentioned the electrical spikes on trucks.  That 's why I added the capacitor.  It slows things way down, but will filter out most short duration spikes. Since the inputs are from switches, a few milliseconds of delay shouldn't hurt.

-Rick

david

26V via 10k?  You can run a PIC at 4MHz with that but the problem is the voltage won't stop nicely at 3.3V if the circuit is unpowered.
Even if powered up, if the total load on the 3.3V regulator is less than 2.6mA then it can't sink the input diode clamp current and the supply will rise above 3.3V.   Regulators can't sink current.  Optos are looking good or maybe even a white LED as a clamp.

Cheers,
David

rick.curl

OK.  I agree.  I like the idea of a white LED as a clamp.  A 4 volt zener or Transzorb would also do the job.

-Rick

trastikata

#14
Better install a 50c TVS IC - the likes of TVS0500 instead of zeners or other diodes.

John Lawton

The capacitor will absorb any fast spikes, so the zener would cope fine with what's left.  Also, put a high value resistor such as 100k in series with the port line, then negligible current will flow even if slightly over voltage.

Peter Truman

Ok - taking on board what everyone has said - I'm looking at the attached as the solution as the safest and most reliable digital input in the circumstances described.

Using the ACPL-244-560E

Assuming an unknown input value, but constrained to a highgoing signal (common ground) between say 11 and 26vDC - could be in a truck with horrible electrics, most likely in a proper panel using the same 24vDC PS

I don't really have the space to add a TVS for each input and TBH, if there is more than 11kv spikes flying about then the EMF would likely fry the PIC anyway? (otherwise I would)

I've added 0.1uf caps to deal with any bounce (roughly 0.5ms RC)

This has been a great help - many thanks




david

I have two questions which I couldn't resolve by looking at the miserable data sheet for the opto device.

With low voltage logic is it better to use a grounded emitter output (with collector load) or the emitter follower as shown?  Generally the VceSat will be much lower than the Vbe.  Just how high do those emitters rise?   And yes - I know changing would invert the logic.

When the opto transistor turns on it has to charge the 0.1uF.  I know it seems like chickenshit but just what is the peak current at turn on and how much can the opto device cope with?
Pessimism over.....

Cheers,
David

Peter Truman

I could easily flip the logic - no trouble at all. What's the general opinion?

John Lawton

Quote from: Peter Truman on Aug 22, 2023, 01:43 AMAssuming an unknown input value, but constrained to a high going signal (common ground) between say 11 and 26vDC - could be in a truck with horrible electrics, most likely in a proper panel using the same 24vDC PS

I think that in vehicles, the load dump transient is the one to worry about, e.g. according to this article it could be over 200V so I suggest that you size your opto input resistor (why use two?) so that the diode maximum current(s) are not exceeded at 200V. You may then need to increase the opto detector load resistor to compensate for the lower opto sensitivity at the normal working voltage range.

BTW, I don't see much difference to common collector or common emitter connection with an opto-detector transistor.

John