Category Archives: Motor Controllers

DS18B20 – Temperature Sensors

I need to add temperature sensors to my MC4X15A Motor Controller so I can monitor HEXFET temperature and cut the H-Bridges to protect the HEXFET’s. I have 2 analogue input’s designed for temperature sensors, but I also have a bunch of DS18B20 laying around.

 

DS18B20 is a one-wire protocol device and you use it’s IO port to bit-bang 2-way communication. You can actually program 18B20 with threshold values to give alarms and connect it as a network. It is a very advanced and popular device. It also have internal reference so it gives temperature with +/- 0.5 degrees accuracy.

 

I have a bunch of these around, so I will connect one through the end-point connector. On the next revision I will modify the these ports to use these. I actually could use the temp port as is and the parasite mode illustrated above as well.

Motor Controller – Current Sensing

I don’t get much sense out from the INA210 at 0 – 2A. Firstly I realize that I use a far to large Shunt resistor. I use a 0.1R by mistake. 100mA would give 10mV that amplified with 200 should be 2V. At this size the Shunt become my weak point. At 3A it starts getting very warm as I dispose 0,9W and it is rated at 1W. I need to replace this, but I accidentally lack smaller shunt’s yet.

With 15A and 0.001R I should get 0,015V that amplified with 200 should be 3V. With a 12 bit ADC giving a range of 4096 I should in theory have a current sensitivity of ca 4mA (15A / 4096).

For now I need to wait on 0,001 shunts, but I will find a load that can support 0-150mA so I can test this range.

I want to test INA210 a bit more to see if I get any sense out of it, but it cost 50c and the tiny package makes it a pain to use. Using a 2 layer PCB I am also at a disadvantage regarding noise.

As for load testing… I am melting my load at 3A. I use 10 x 0,47Ohn @5W in series to create a 4,7 Ohm 50W resistor, but it get so hot that it melt the soldering tin on my home made load. I have mounted a 40x40x10mm Heat-Sink and the only component getting hot is my 0,1R Shunt. I can manage 10A out from my Lab PSU and that will have to do for now. But, I want to move load testing to a  different boards with only PWM driver Circuit before I continue. It is basically so much work to solder a full board that I don’t want to destroy this one. Have been replacing 5 x HEXFET’s so far as I tested without heat-sink. I can only sustain 1A without a heat-sink on. I need to do the math here as I expected more.

All in all – this design seems to work. It will be down to current sensing and finding an optimal heat-sink I think. But, I am currently only testing 3A and it’s a way up to 15A continuously yet – mostly stopped due to lack of test equipment as we speak.

MC4X15A – Motor Driver Testing

I am so far happy with the MC4X15A PWM channel with the exception of the current sensor. I have 3 more channels to solder up, so I will do the next without the low pass filter for comparison. I did not like the scope pictures, but will be interesting to see what I can do in software.

This picture illustrate some of the challenges involved in scoping. I am using a 2nd SWD adapter to get hold of the 4 pins so I can scope them while testing. As mentioned while I meade this I intend to destroy a few boards to learn the driver limits. I accidentally burned transistors with a shortcut, so will be interesting to see the limit as I add heatsink.

I am also running the MCU at 8Mhz yet. It will be interesting to see what happens as I increase frequency and things get more sensitive as I have a lot of noise at moment. The HEXFET’s have a 30V limit, so if the PSU noise is an issue I will replace the DC/DC with a 78M12. One thing that works well is the supercap. I am surprised of long it keeps the MCU ticking after power-cut and it should do wonders in absorbing spikes and protecting the 3.3V.

One of the next things I will do is to solder up a PWM channel on a separate board and burn it. This test is a bit tricky as I don’t have a Lab PSU to support the test yet.

3.3V Supercap

These are the two different PSU’s used on MC4X15A – notice the supercap X20. I mounted a 0.33F Supercap for the purpose of keeping the MCU alive during powercut’s + act as a spike absorber on 3.3V. I am impressed – the PWM cut instantly, but Led’s and MCU keeps going for several seconds.

INA210 Corrected

The first thing I noted was that my current readings went into negative voltage, so a bit research and I moved the ref pin 1 to ground – it seems to work better. I won’t know for sure before I activate the ADC and print readings. INA210 is supposed to have gain 200, but I fail to measure that with a multimeter. Lets see what the ADC says.

One thing I do see is noise – lots of it.

MC4X15A – Motor Controller – First Test

These two scope pictures stunned me before I realized the mistake that stunned me even more. The first picture show HEXFET Output in yellow, Logic High/Low Cyan and Purple and BEMF voltage in Blue. The upper picture is with no load and the 2nd is with a DC motor as load. Why do my High signal get disturbed ? Read on and get amused!

The answer baffled me. At first I was puzled by how weak the motor felt, but it was working and the controller with motor used 21mA – up to 40 if I held it. But, what was wrong? Looking at my test set-up I suddenly realized I was driving the motor directly from the STM32 High pin.

 STM32 delivers up to 40mA per pin and this motor worked on 3.3V 21mA or something. Connecting it correctly it felt like a formula 1 in comparison.

Half-Bridge Shortcut

This schematics show the PWM driver stage of MC4X15A. IRF7862 is rated at 17-21A continuous current and pulses as high as 170A, but yesterday I took out two simply because I replaced IR2103 with IR2101 and did not realize that the later have no short-cut protection – so the MCU switched on both High and Low, dragging the PSU down. It was only ca 4A, but with no heat-sinks the SO8 packages will be exposed, so they snapped from overheating.

I planned on burning this board a bit, but not yet – I want to test if it works before I stress test it – lol. Well, new HEXFET’s – new try + I need to remove that IR2101S and get a IR2103S on.

Good news was that I could connect to 3.3V and things worked – it was only the HEXFET part that failed – no marks on the PCB or other Components.

3.3V PSU on MC4X15A

This scope pic is from the 3.3V on my MC4X15A – Universal Motor Controller. The MCU is running and I have the 0.33F Supercap mounted. Ca 200mV point to point ripple is to much for my taste, but it works and this is far better than I have measured out of the Lab PSU’s. I am also using the DPS5005 in this case just to see if it worked at all.

This started as a small experiment as I wanted to see the effect of swapping out the inductor on my LMR14206 – I obviously need to revisit my lab PSU design. The lab PSU and scope is located next to each other on the shelf and I only need to switch it on to introduce noise – I don’t even need anything connected. I obviously have introduced a noise source in my lab that I need to figure out.

This is a set-back because I have been extremely happy with DPS5005 before this.

Returning to LMR14206 I seem to be stuck with 200mV point to point ripple. I am also puzled to as why I see the same ripple on 12V and 3.3V, but I will get some help investigating that. The actual reading on the scope pic is much higher, but that is the external noise. The ripple signature will differ a bit from using DPS5005 versus Thaoxin as they introduce different noise pictures. The small spikes you see above is the 1.25Mhz switching frequency of LMR14206 – and just for the record – it’s no problem adding a filter on the 12V and remove this ripple, but that add PCB size and complexity – part of the objective here was small space.

New DRV8313 BLDC Controller

My previous DRV8313 design used the larger 64 pin F105/F405 MCU and a more complicated sensor design. What I could do is to use the smaller F303 that is 48 pin and fokus on hall sensor driven motors to get size down. The issue is that current sensing is very difficult/unreliable for small motors on low speeds, so ignoring these sensors will simplify the design – reduce size.  The challenge here is that I am not very good at compromizing – I don’t want this BLDC for a project, I want it because I want to experiment with the design and coding – so I want “everything” on it like a spoiled child …

This last draft is the same as before, but I replace F405/F105 with F303 so I can take advantage of it’s programmable Op-Amps to scale current sensing to the motor. I am considering a version where I cut DC Rail, current Sensors and BEMF Sensors as well, but for now I can just design them in and avoid assembling them.

The issue with current sensors is that it’s a huge difference between 2.5A and 50mA. If you dimension the sensor for 2.5A and 500mV you will typically read 10mV on 50mA. The signal get so weak that it risk drowing in noise. So to compensate for this I need to add filters and amplifiers. This also makes it more challenging to control motors on low speeds, while current sensing is excellent on high speeds where you get strong current signals. STM32F303 can compensate for this by using 3  programmable, built in op-amps that amplify the signal. To be honest it is actually far more complicated to make a small BLDC Controller than making a large one.

While I like the STM32F030F4 due to their size they make no sence in this case. I need a 48pin package so I get all 3-phase motor pins and I need the programmable op-amp build into STM32F303.