# Digital Input Simulation

Nominal automotive voltages range widely. Your circuit needs to handle anywhere from 10V to 15V to properly function correctly. This is a challenge on the power supply side but it is forgotten often on the input/output control side of the circuits.

Below is my current digital input circuit for the Cyclone Pulse Wrangler. This is an active low circuit. A switch pulls AUX_DIGITAL_IN to ground. This goes through some filtering and a voltage divider so the 3.3V MCU can safely determine if the switch is activated or not.

On the MCU side (SAM D21 in this case), there is a threshold on the GPIO input on where the MCU considers the difference between a high or low signal. We need to make sure over the range of the power supply voltage (10V to 15V) that the MCU considers it to be a high signal.

This in page 875 of the family datasheet. VDD is 3.3V in our circuit. VIL and VIH is what is important here. VIL is 0.99V and VIH is 1.815V. This means if the voltage on the GPIO pin is high and drops below 0.99V then the MCU will register that as a low. If the signal is low and rises above 1.815V then it will consider it a high. Between these voltages it doesn’t initiate a state change.

We need to check to see our circuit stays above 1.815V output across the entire span. LTSpice is a goodish program to do this

Above is the circuit in LTSpice. Stepping the +V from 10V to 15V gives the following output.

Well that isnt good! At 15V we get ~1.9V but at 10V we get ~1.26V which is in our gray zone! Lets change the 2.9K to 5.1K (R33) and see what we get.

OK! Everything is in our deterministic range for a high signal! But lets check for resistor tolerances. Running a monte carlo simulation with 1% resistors gives us the following outputs. 10V rail and then 15V rail.

Well that looks good as well. Digital input should operate fine on the Cyclone Pulse Wrangler!

Automotive temperature sensors are typically thermistors. Resistance changes as the temperature changes. Most of the time you don’t want this to happen in normal resistors but thermistors are designed to change in a predictable manner so they can be used as sensors.

There are multiple ways to read the resistance of a thermistor but the easiest way is to make it part of a resistor voltage divider and use an ADC to convert the mid point to the temperature.

This is the circuit I designed for the Cyclone Pulse Wrangler.

This is lifted from a variety of open source engine control hardware circuits.

I don’t know who or where the original 2.49K ohm pull up is from but most aftermarket sensors reference that pull up as well. I like AEM sensors and use the 30-2013 sensor in a lot of projects. They include easy to find calibration charts.

Now this is great if you are using a 5.0V sensor rail but the Cyclone Pulse Wrangler only has a 3.3V rail so some conversion is needed. I used chatGPT to convert the chart in the datasheet for the sensor into a CSV file I could import into a google doc.

Then just used some ohms law magic to make the below chart. Here is a link to the google doc if you want to see the formulas and copy it for other sensors.

There are some downsides to this method. Since you are passing current through the thermistor there is some self heating involved which will of course change the resistance of the thermistor… and then change the current… and then change the resist…. yeah you see where this is going. Here is a good paper on measurement error in thermistors due to self heating by Ti.

A way around that is to control the voltage supply that goes into the voltage divider and only turn it on when you need a reading. Chips like the MAX6682 do this automatically. A high side fet could be incorporated into the design.

Is this a big problem in automotive applications? Engines run around the 100C mark so lets use that resistance from the chart above (175 ohms).

With the 2.49K resistor on the top side of the divider we get a voltage of 0.217V across our thermistor. That is ~0.00124A of current across it. We are talking 0.00026908 watts. Compared to the engine coolant. This is nothing.

Another source of error is current through the ADC. You want a high impedance here to prevent leakage current changing the reading. Most modern ADCs in MCUs are going to be high enough to prevent this being an issue in an automotive setting but it is always good to check if you are using a high end ADC that has low input impedance. An instrumentational opamp might be needed.

# Converting to LibrePCB

With Eagle being having a sunset date from Autodesk and not wanting to use Autodesk Electronics (Eagle in Fusion). I looked for EDA tool alternatives. I spent a good portion of the beginning of 2024 learning and building a product in KiCad v8. See the launch video below.

After fighting KiCad for months, I gave up and will be trying out LibrePCB.

I have converted my Cyclone Pulse Wrangler circuit to LibrePCB. So far I am very happy with the tool. It needs a few QOL improvements but, overall, much more enjoyable experience then KiCad. I am not constantly looking up how to do simple actions.

LibrePCB has a REALLY good Eagle Part Library importer. One of the best I have ever used.

The tool also supports plated slots in the footprint editor natively. No “workarounds” that are required in Eagle and KiCad to pull them off.

I have only used the library and schematic editor. Both are missing more complex tools that Eagle and KiCad have but for 99% of PCB designers and users. They will never use those… and I rarely use them as well.

Let us see how the PCB layout tool is!

# The Cyclone Pulse Wrangler

This is the evolution of the “jeep prop fan” controller I built what feels like a life time ago.

I did build this board as well back in 2016 but never finished the code or used it in the Jeep.

Here is the github repo of what I have so far. I did a complete redesign and rescope of the project. The original was more of a Power Control Module. Gonna try to stick to just a PWM fan controller this time around.

https://github.com/LonghornEngineer/Cyclone-Pulse-Wrangler

Biggest change was moving to a SAMD21 mcu. Have lots of these left over from my pinball controller days.

This is the PWM output circuit. Pulling the signal to 12V though a 100ohm 1/4W resistor. A2N7002H-HF n-channel fet pulls it down.

Here is the digital inputs to the system. These are active low inputs. 12V is the high. I am using a voltage divider to knock down what is the max voltage of ~14.7V to ~3.3V. I am not 100% sold on this circuit yet and might go with an optocoupler if convinced with the right part number. A 3.6V Zener Diode (BZT52C3V6-TP) helps make sure that I/O pin doesn’t get too out of wack.

To read the temperature sensors, which are thermistors, I just lifted the circuit that other engine control uses. Low pass filter and a pullup. I/O pins are protected with a SP721ABG SCR/Diode chip.

The last part to highlight so far is the driver outputs. These can be used to drive relays or indicator lights or whatever. These can be a voltage source or a ground sink depending on what is needed. Basically a half bridge setup. Don’t set both I/O pins high Maybe I add in some gate logic to prevent shoot through condition? Or just write the code with a check before setting the outputs?