Category Archives: STM32 Development

X-Mas Tree Decorations – Part 1

Every year around christmas I tell myself that next year I will have electronic christmas decorations, and as next year arrive it’s forgotten until it’s to late. A combination of STM32F030 and ULN2003 is excellent for a very small x-mas tree PCB with blinking LEDS and home made tree lights. In fact I have done this circuit before as a PWM driver with a single ULN2003, so what I will do is to make multiple PCB’s with LED strings connected through a RS-X (12V + RS485). These can then be wired in the x-mas tree and controlled by RS485 connection and 12V LED driver.

STM32F030F4 is excellent for this purpose, it cost 0.4 USD from AliExpress and all I need are sufficient to cover 20-40 of these. A 5A LED Driver should be more than sufficient. We make a harness with connectors up the tree where each decoration connect to this is a star network.

Application can be constant or random patterns as a start to make it simple. In fact I could make a small ESP32 control system with RS485 at bottom so I get the entire c-mas tree on Wifi or bluetooth. This could be a lot of fun.

The cost of this will be 2-4.- USD per PCB, around 10.- for the control system and a bit for the wiring. I probably end up spending around 100.- USD for a very attractive x-mas tree light system.

I can probably use up to 200mA per ULN2003 and a quick calc is that a single LED uses around 5mA, so in short – I will run out of space and LED’s before I run out of power. But, we should limit each decoration to ca 250mA max – I will probably need far less.

MC4X60V goes 50A

I decided to remove some of the PCB lanes and replace them with high current wires to support 50A currents. I had to extend the board ca 1.5mm at right, but to compensate I also remove the connectors because I need high current support all the way. I like having connectors for <10A solutions and playing in the lab, so will see what I can do. This will also free up 2-3mm that I desperately need at left.

At the end it simply made no sense to continue with 15A limit as I realized I would be using the same components and same space for a 50A design. And yes – this is a 50A design. The power wires are 3mm in diameter that actually is something like 64A while the 2mm wire for each channel is ca 41A. But, in addition to this you also have heat-sink at bottom as I connect the PCB itself to the heat-sink. I am confident that I will get sufficient out of this board.

Updated 4X Motor Controller

This is just a simple block diagram over MC4X design to illustrate it’s components and summarize the planned changes.

  • More communication ports CAN and RS485. I hope to save some space and add more communication ports to support redundancy etc.
  • New PSU based on TPS54x60 providing 14-60VIN or 10-16V in. Support 10-12V for Gate driver, 5V for Hall sensor and 3.3V for MCU.
  • Added 2 temperature sensors on board located between MOSFET’s.
  • New INA194 base current sensors.
  • New SOP Advance MOSFET footprint will support both SOP-8 and SOP Advance allowing a wide range of MOSFET’s to be used.
  • 4 separate channels with IR2103 as Gate driver.
  • 4 separate high side current sensors.
  • 4 separate BEMF sensors,
  • Separate Hall Sensor port/Encoder port for additional positioning feed.
  • Separate end point connectors for positioning calibration.
  • Replace 2.57 pitch connectors with smaller 1.27 pitch
  • Move main caps on board
  • Change size to fit heat sink 100x40mm
  • Stick to 15A design as objective, maybe increase to 20A depending on what PCB can manage
  • Added pull-downs on PWM driver to avoid that gates are floating.
  • Use JST Micro as channel connectors.
  • New SWD Connector.

As for now I am still testing rev 1.0, so things are not written in stone. As for the new 3P controller I have put that on hold. I decided I wanted to do rev 1.1 of MC4X first. I do after all also have 3X coming in any day now.

I still have plenty of DRV10983 chips and boards so I will be playing around with that as well – we got plenty of motor fun coming up.

I have ordered separate test circuits for INA194 and this part is the only one that concerns me because of noise. I need to see if I can get a INA210 working on the existing design to test noise and noise filters.

 

60V/50A Motor Controller PCB

This one was not as hard to route as I expected. I had to do a few compromises and I need to look things over. Ground plane include a few lines that I want separate etc + I need to ensure that all ground planes are connected. But, this looks good. A bit to dence and I really could have needed 4-6 layers here for analogue signal quality.

  • Size 100x25mm
  • 8-60V / 50A capacity
  • STM32F405RG or STM32F105RB etc
  • RS485
  • CAN
  • Hall Sensors or Encoder port
  • 3 x Current Sensors
  • 4 x IO ports (3 analogue capable)
  • DRV8301 based
  • 160A MOSFET’s
  • Components on top-side only.

Returning to my 24V/15A design it is actually the same SOP-8 sized MOSFET’s, so as soon as I have tested the 60V DC/DC and current sensors I will upgrade that as well. I need to decide if I want to leave it at 24V or upgrade to 60V or increase current capacity.

Looking at MC3P60V50A above you can also see that close to 33% of the board is DRV8301 (Gate Driver). This is 2 cm longer than MC4X24V15A, but more narrow since it has 1 less channel and did not need the separate DC/DC. Components on top-side only is a big win.

Printing this one out on a printer is actually scary – it is much smaller and denser than I realized, but this will be fun to play With.

Fedex Norway slam customers

I purchased 4 packages from Arrow in US (MOSFET’s) and I was surpriced that P&P was included free – and yes it is. But, Arrow uses Fedex that add a fictive P&P as this is declared to Norwegian customs and this made the value look like it was above the free import limit – which it is not! This basically allow them to charge me 12.- USD in handling fees on top of 12.- USD in MVA. So a package that costed 29.- USD suddenly “cost” ca 53.- USD. That is almost 100% import duty on packages from US in this case. These packages are actually free (no MVA) below 40ich USD, so this makes a big difference.

I have complained to Fedex and Arrow. I will not stop using Arrow, but this extra cost will need to be calculated in. Arrow is an innocent victim of a very bad Fedex practice here! Fedex are actually obligated to find out what the actually P&P is and inform customs, something Arrow should have stated in the invoice.

I will complain about the extra invoices. I feel sorry for Arrow that actually have made a very competetive deal and get their business slammed by a bad Fedex Norway practise.

MC3P60V50A – 3KW Motor Controller

This will be work in progress for another week at least. I have routed the right side of DRV8301, but I have the left side + MCU left. I initially started with a STM32F303CB, but decided to move up to a STM32F405RG. Current size is ca 100mm x 25mm and components only on top side. I have received the 60V/160A MOSFET’s I plan to use.

This is a dedicated 3-Phase controller. I have so far added JST connectors for SWD, CAN, RS485 and 6 sensor inputs. I will add bias and jumpers for RS485 top-left + I would like to add a USB connector, but I probably need to sacrify CAN or RS485 to do that.

Compared to MC4X24V15A this is 20 mm longer and 15mm thinner design with components on the top side only – but, let me finish routing before I brag to much – I do however think that worst case here is another 5mm in thickness due to density on left side – lets see. 

I will solder up a new MC4X24V15A to complete testing and start writing actual code. I have received the MOSFET’s. The old board is stil working, but reduced to 12V due to some destructed lanes that proved difficult to repair. But, that is ok for algorithm work on lower effects.

Size of things

This show 3 components on a 3D model. The one to left is a 0603 package, and if you have any idea of how small that is then you also see the size of INA210 in the middle. INA194 is SO-23/5 which is “easy”. I consider 0603 easy as well, but 6 pins on that INA210 was a bit on the edge.

I have never tried a 0402 component and based on my experience with 0603 I don’t think I want to either – not with manual assembly.

INA194 – 80V Current Sensor

INA210 that I used earlier is only rated for 26V, and it is a 6-pin extremely small package that was a Challenge to get soldered. I have 9 more chips to destroy before I let INA210 rest, but I will not continue with this for 3 reasons (1) size of a 6 pin package and marking made it difficult, (2) 26V is to limit and (3) I finally discovered INA193 to 198 that is SOT-23 based (larger) and support 80V.

Texas Instruments have a large range of current sensors and the series 193 to 198 is sensors With fixed gain of 20, 50 and 100. The difference between packages are pin layout, but they are all SO-23/5. This is small, but my main struggle With INA210 was to identify pin 1. SO-23 is a little larger and that makes a difference.

Input Voltage on these are 2.7V to 18V, but sensor input support -16 to 80V. No external Components are required, but some fltering is recommended. Prices are in the region of 1.7.- USD for samples – 0.8 USD for 500 volumes. So what gain do I want?

50A * 0.001R = 0,05V and I need a 3Vich so gain 60 – or 50 which is INA194 should be workable. Using a 12 bit ADC over 3V I get a sensitivity of 3/4096, meaning the value 1 represent 0.0007V. Using a 0.001R shunt that is 0.7A direct sensitivity – amplified with 50X we should have 0,014mA sensitivity giving a range 14mA to 50A – in theory.

The alternative is that I double the Shunt and use 20X gain – that will give a 17mA sensitivity, but should be more reliable as we get a better signal/noise situation. The challenge is the effect over the shunt. 50A is 2.5W on a 0.001R and 5W on a 0.002R. I hope to get away with 2.5W since it should be divided by 3, but I need bigger shunts for 5W. This is however a workable improvement for a 15A design where 15A should be 0,45W over a 0,002Ohm.

This is the 3rd reason I want the 3rd sensor on the 50A design – to be able to test current sensors and what I can achieve. Using 50A I need to worry about effect usage, using <50mA I need to worry about signal/noise – so whatever I will be a trade-off. DRV8303 help in the sense that it has a PGA (Programmable Gain Amplifier). You can also get stand-alone versions for that, but they require I2C or SPI. And adding more Gain will not improve Signal/Noise factor or change the size of the shunt.

INA193-195 are a bit expensive, but they are worth it if they do the job. I ordered 10x from Arrow for 18.- USD – they will be here in ca 5 days.

STM32F105 Limitation

Bummer – just received my USB/CAN adapter PCB’s and realized that they are wasted. Soldered one up, but as I intended to activate USB I realized 2 things: (1) HSI can only be clocked up to 36Mhz and (2) USB will only work with HSE (External Crystal).

I have these small Murrata ceramic Crystals that take no space, so not sure why I did not just added them. I obviously need to order new PCB’s, but I have other dev cards I can use for USB testing. This error could have been avoided if I had checked with CubeMX first.

The New SWD port with micro JST works fine. I am just using a cable to the old adapter.