Digital/discrete inputs - Sergey89

Hardware inside and outside of the ECU
Post Reply
User avatar
Sergey89
contributor
contributor
Posts: 839
Joined: Wed Sep 25, 2013 5:30 pm
Location: Russia, Velikiy Novgorod

Digital/discrete inputs - Sergey89

Post by Sergey89 »

For some additional features we are need to determine the state of the external switches in the firmware.

This is one of the ideas.

Pull-up or pull-down resistor is used for "active low" and "active high" switches.
Attachments
digital.png
digital.png (9.22 KiB) Viewed 5161 times
digital.gif
digital.gif (39.29 KiB) Viewed 5163 times
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: Digital/discrete inputs

Post by puff »

what about contact chatter?
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Digital/discrete inputs

Post by AndreyB »

For time being we can probably use analog inputs for discrete inputs? But at some point we definitely need add these. maybe even for Frankenstein. Need .sch and .kicad_pcb files for a tiny module so that we can merge it onto Frankenstein.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Digital/discrete inputs

Post by kb1gtt »

R1 / C1 make for about a 3mS step response, which will help with de-bounce. Anything left can be fairly easily done in software. I'm not sure I'm crazy about using D2 to dump an excess in voltage. Would this play nice with those 40mS spikes up to 100V during a load dumping and such?

I guess I don't know the requirements. What range of impedance are we looking to satisfy, as well what voltage ranges do we expect, and what kind of noise rejection should it have? Why not use an opto-isolator?
Welcome to the friendlier side of internet crazy :)
User avatar
Sergey89
contributor
contributor
Posts: 839
Joined: Wed Sep 25, 2013 5:30 pm
Location: Russia, Velikiy Novgorod

Re: Digital/discrete inputs

Post by Sergey89 »

I think that the maximum voltage is determined by the maximum power dissipation of zener diode. So 100V is not a problem if zener diode is still works.

Most digital sensors just switches to ground or to the positive battery terminal.
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Digital/discrete inputs

Post by kb1gtt »

I see the diode can handle up to 500mW and has about 300C/W and a max junction temp of 175C, So if we assume max heat sink temp to be 75C, you have 100C in rise you can handle. Which limits to about 333mW. Then at 3.9V that means you can handle a max continuous current of 85mA I see your base current is 1.14mA and each switch adds .74mA, so you could have around 100 inputs before you start to hit thermal limits. So it all looks good thermally, assuming there aren't other sources of heat that cause the zeners temp to rise via external means.

I also see the nA leakage of D2 as a critical feature of that diode. If that diode leaks more than about 20uA, your in trouble. So nA is required as this diode datasheet claims. I wonder about what kind of chatter you'll get from the small uS of recovery time. You may need a slight software de-bounce for that. However that's probably going to be seen as a delayed signal, not chatter so it's probably fine. Hmmm, I wonder if the diode is susceptible to ambient light. Often you get much different ratings if you shine some bright sun light on it instead of having it in a box. Same can happen with near by RF or magnetic fields. When dealing with leakages in the low uA range, those situations can start to become an issue, as they can cause the diode to leak more than the spec sheet claims. However that's determined in the layout, so I don't know if it might be an issue or not.

I might recommend including 2 caps for C21, one for low frequencies, and one for high frequencies. I think you'll find the LPF is more of a notch filter. Also diodes often like to make high frequency noise. I might recommend a small cap across the diodes to squelch that potential source of noise. I kind of wonder how the layout will work out as the + rail can get fairly long. I wonder what kinds of transient spike you might get before the energy makes it to the +rail zener to get dumped. I generally like to dump to GND not the + rail.

I'll try to reply better about sodu's schematic shortly.
Welcome to the friendlier side of internet crazy :)
Post Reply