A New Project

I’ve been planning on making a custom arduino based industrial I/O module for a while. Something that, with the arduino IDE, would in effect be a structured text PLC. However, an arduino uno or nano would make for a limited system in terms of program size and built-in functionality. An alternative would be to make a custom chipset that programs like an arduino, but, chipsets like that have already been developed. One such chipset module is the esp32 wrover-b. I’ve wanted to begin developing with the esp32, and this project to make a PLC seems to me a perfect place to start.

My tentative specifications are:

1. Exploit all available wrover-b I/O pins to have industrially hardy, 24VDC, opto-isolated programmable DI/DO and AI/AO where feasible.

2. Wire esp32 wrover-b communication pins to expansion ports to connect with I/O expandion boards. It is acceptable to use an interposing uC as necessary to support addition communication protocols. Optoisolate or otherwise protect all communications ports as much as can be done without harming speed or signal strength.

3. Include a programming port for the wrover-b, preferably supporting micro usb.

4. Program the esp32 to accept wifi connections for output overrides or reading of inputs, serving an html page to facillitate this and also responding to certain get requests with just the requested data for data polling. All with as much security as I can give it.

Hall Effect Current Measurement

Hall effect current measurement isn’t a direct measurement of electric current.  Rather, the hall effect is caused by the magnetic fields that electric currents produce.  Hall effect describes a change in resistance of a very thin conductive film when it has a magnetic field passing through it perpendicular to its surface.  Thus, the hall effect is a direct measurement of the magnitude of a certain orientation of magnetic field.  When the thin film is properly situated near a larger conductor, the magnetic field measurement can be turned into an accurate measurement of the current through the larger conductor.  Reading unwanted nearby magnetic fields is possible, and strong magnets can saturate the hall effect sensors, but shielding measures can be taken to prevent those sources of error if necessary.

So the thin film is placed near a larger conductor, and the hall effect causes the resistance of the thin film to increase as a function of the magnetic field arising from the current through the larger conductor.  This resistance is then converted into an output voltage by passing a separately sourced current through it, the signal is given low source impedance with a follower and/or amplifier, and we get an accurate measurement of the current without being in direct electrical contact with the conductor being measured.  This ability to measure current without contact is highly advantageous in situations where the measurement has to be made at a portion of the circuit that is at a high voltage with respect to ground, and the current source can be designed to provide as much accuracy as necessary as well as providing outputs that are linear with respect to current.

Shunt Type Current Measurement

Shunt type current measurement is a pretty simple method.  It is effectively just measuring the voltage drop across a known resistance, and applying Ohm’s law (V=IR) to calculate the current.  But, in practice, there are a lot of issues with this.  First and foremost is that higher voltage drops are easier to read, but the higher the voltage drop across the sense resistor, the more power is wasted to heat in the sense resistor, and the more heat, the larger the resistor needs to be.  It is possible to gain some current data from a sense resistor with a maximum voltage drop of 100mV, but expensive, sensitive, and highly accurate instrument amplifiers are required, and it still may not be possible to tell the difference between, say 3/4 of the maximum current and 13/16 of the maximum current.  So to use shunt type current measurement you either have to waste significant power in an expensive and large sense resistor or rely upon expensive instrument amplifiers which can easily be sensitive to thermal or other sources of electrical noise.  But that’s not all.  Shunt type current measurement also inherently suffers from non-linearity due to temperature changes because no resistor material has constant resistivity with respect to temperature.

Broadcom ACHS-7123

While taking my BOM to Mouser to plan a parts order, I found that one of my preferred board mount current sensors, the Tamura L18P030S05R isn’t currently available in low quantities.  Fortunately, there is an equivalent hall effect type current sensor that comes in a smaller, cheaper smd component, the Broadcom ACHS-7123.  I prefer this technology over shunt type current sensors, as I think that they are, overall, cheaper, more accurate, and smaller, and this “new to me” Broadcom chip is a fine example of that.

Simplifying my 24VDC ESC, VFD, Inverter

I’ve been working on simplifying my 24VDC inverter design using the MIC4605-1YM in place of my individual component gate drivers, and I’m revising the layout with more layers, a switch and pot, smaller PCB area, and aligned and grouped SMD components for pick and place.

Anyway, while perusing the data sheet for the MIC4605 again, I discovered that the MIC4605-1YM’s shoot through protection isn’t quite the same as what I think the L6498 has.  The shoot-through protection built into the MIC4605-1YM adds a long (relatively) 240ns delay when it is activated.  This means that the protection can’t be relied upon to permit one to drive the high and low inputs intentionally with “wrong” but more efficient signals.  As a result, I’ve had to add in a couple of fast quad logic gates to implement what is effectively an instantaneous shoot-through protection logic ahead of the inputs of the MIC4605-1YM.  This is a little disappointing and it eliminates the cost and size benefits of the 4605 over the L6498, if the L6498 operates with delay-less shoot through protection logic.  The caveat to this is that the L6498 datasheet doesn’t explicitly state that the overshoot protection is delay-less, and I’ll have to test it to confirm that they have the functionality I expect.

ESP32 and Psoc 6

There are two system on a chip devices that I’ve been looking at for more advanced on board processor applications. These devices have a good amount of flash memory for programming, fast, 32 bit processors, ample ram, and most interestingly, wifi and bluetooth interfaces built into a single chip. Two of these are the Cypress PSoc 6 and ESP32. The ESP32 surpasses the PSoc 6 in a few specifications such as almost twice the ram, and the ESP32 has a packaging option that includes 2MB of flash memory. But otherwise, the chips are comparably capable. So another thing to consider is ease of development. The ESP32 can be developed in the arduino IDE, which promises good community support, but the basic arduino programming language wasn’t intended for the ESP32, so additional open source libraries are required to unlock the esp32’s full functionality. The Psoc 6, on the other hand has companion windows development software designed specifically for the chip that is supported by the manufacturer.

The big differences between the systems comes in packaging. The ESP32 is increasingly available in mini modules such as the WROVER which include expanded memory for use as mini networking computers. But this module comes in a 20 pin package, severely limiting the parallel I/O capability. The psoc 6 on the other hand is available in a BGA116 package with 78 I/O pins or is also available in their WICED modules with built in antenna to provide Bluetooth tx/rx capabilities comparable to the WROVER but the WICED modules lack the wifi and added memory, and are more expensive.

All in all, it looks to me like the ESP32 and its modules have an advantage for now for most simple networking applications, with cheaper, more capable modules, and I’m going to focus on it for those.

ST L6498LD 500V Gate driver

This half-bridge high and low transistor gate driver solution can be used for higher DC voltage power buses, up to 500V, and is faster for transistors with higher input capacitance.  The only drawbacks when compared to the Micrel MIC4605 or MIC4604 are that the Micrel chips are available in smaller packages then the L6498 is available in because the L6498 can pass more power to the transistor gates, and the Micrel chips are presently cheaper.

For now, the L6498 is my choice for general half bridge circuits switching voltages in excess of 80V.  This chip does not have a single PWM input, having instead separate high and low inputs, but this is actually a feature as the chip has built in shoot through protection, and the voltage control switching can be applied to the high side while the current direction can be applied to the low side.


Micrel MIC4605

I’ve been lately searching for the best half bridge driver IC’s for my reference.

A good, fast, and cheap half bridge driver for DC main voltages up to 85V is the Micrel MIC4605-2YM-TR.  This device requires only two additional capacitors to work, and is triggered by a convenient single PWM input.  The device ratings indicate that it should still be somewhat functional at PWM frequencies up to 1Mhz for driving power mosfets with gate capacitance of 1000pf or less, but no doubt operates with much easier to insure (easier to design a pcb for) reliability in the 50-200kHz range.

I still need to find the best IC for DC mains up to 300V, if such can be found.

The search has been educational.  For one thing, I’ve learned that the shoot-through protection on the output of these chips affects the output timing of every HO and LO cycle, basically holding HO low until LO is low which affects the usable PWM input frequencies and duty cycles by adding some dead delay time.

The gate drivers circuits and microcontroller of my inverter don’t need that shoot through protection on every PWM_IN cycle.  Rather, the shoot-through protection is only necessary when switching the FOR_!REV output.  Therefore, in the programming of the controller, the PWM_IN output has to be disabled for a few clock cycles while switching the FOR_!REV output from high to low or low to high.  This is a much smaller effect than on the MIC4605 for an inverter or VFD application because the 50% duty cycle PWM output for FOR_!REV is equivalent to the output frequency which will typically be between 50 and 2000Hz.



Assaults on Reason: Test One, Teach Others

It’s been a while since I’ve noted down any assaults on Reason that I’ve seen out in the world. This is a particularly nasty one in which the perpetrator sets up a false, impossible, or just easy to lie about “test” for one target person, and then teaches others that the target person is evil, and that their underlying motives must be evil, without putting any of the targets that are being taught through anything like the same test.

This is an ancient method to accumulate power and influence by simultaneously destroying one’s enemy while discouraging some behavior amongst one’s followers. Even if people realize that it is just manipulation, they are still taught what happens to the perpetrator’s enemies.

For instance, suppose an employee speaks ill of a supervisor. The supervisor tells the manager that the employee is a traitor and proposes a test of loyalty be performed, and before the test, the supervisor tells the employee that the top manager has ordered the employee to do endless unpleasant things. So, when the test is performed, and the manager is listening, the supervisor easily solicits curses of the manager from the employee. The employee is terminated, the supervisor earns the trust of the manager, and the manager discourages dissension, but the people being taught not to dissent were not subjected to the same treatment as the dissenter, and by and large would not have the same opinion if they were.

A second example of the same type of thing would be for a top manager to dress down an employee in front of a supervisor, regarding some matter that the supervisor knows nothing about, as a “test” of the supervisor. If the supervisor does nothing, then the manager declares him to have failed the test for not caring about the employees. If the supervisor investigates, the manager declares him to have failed the test for being disloyal. Either way, the manager slanders the supervisor, and teaches others that whatever the supervisor did or didn’t do was wrong.

A modification of this is endlessly testing one until some failure, then teach others. Basically, little effort is put into constructing legitimate tests with the goal being to make the target’s life miserable and intolerable, thus encouraging some kind of ethical or moral breach. In the end, only the failed test is ever recorded, and the target becomes the example to be taught of what happens when that bad behavior occurs, regardless of how it came about.

The sure cure and prevention of this evil, is something I have stated before, which is that testing of characteristics must be done with full knowledge of the testee, or simply cannot be trusted.