32 x IO Hat

This is the last version of the 32 x IO Hat. I just modified it to use the faster SPI towards RPI bus. The Power connector on the right side is for Servo’s. It enables a different voltage than 3.3V supplied from a separate PSU Hat. The jumper need to be set for 3.3V to be connected to IO. Every line has TVS protection, so this is a decently safe board.

This board basically export 32 pins with TVS protection and add V+ and GND making it ideal for Servo, Sensors or just a plain GPIO Hat.

  • 22 Timer based PWM channels
  • 32 SW driven PWM channels
  • 15 analogue input channels
  • 2 analogue output channels
  • 32 GPIO of which 17 is 5V tolerant.
  • UART/CAN/SPI/I2C ports
  • High speed SPI backbone network
  • CAN Network
  • USB
  • SWD

Wifi Hat Failure

This ESP32 Hat  work perfect on IO, but as I switch on Wifi it short-cut and reboot. I might have encountered my first bad ESP32 module, but I am not sure yet. I need to assemble another unit and see if this works as this is the first time I assemble this board.

This is an ESP based Hat in Raspberry PI Format. This is basically an experiment as I want to test SPI and CAN on ESP32. The design only serve as a low cost alternative to using a Raspberry PI as this has both Wifi, Bluetooth, CAN, RS485, UART TTL, USB as well as 5 Sensor ports.

To be continued.

Stencil Printer

To effectively have a small production line you need to have 3 pieces of equipment/processes.

First step is using a stencil to apply solder paste. this can be done with a stencil alone as a mask on top of a PCB, but a better way is to use a 200.- USD stencil printer. This pic show a low cost one for ca 150.- USD.

Second step is to use the pick and place machine to add components.

The last step is to put this into an automated reflow owen. I actually have one of these, but have not used it much because I solder very fast with a heat fan.

I have 2 reasons for wanting to start using the stencil. It is faster and easier to add correct solder paste, and by using the owen I avoid the number of cold soldering problems I have.

I just assembled a wifi board and sat hours fixing 2 cold soldering – soldering that look perfectly ok through a microscope, but actually is not connected. These problems take time and the first step in improving is to actually use stencils and the owen while I ramp up for a full production line.

The drawback is that a PCB that usually cost 5.- USD now will cost 50.- due to the cost and P&P for a stencil with frame.

Pick & Place Machine

One of the challenges I face is that I would like to start producing electronics in volumes, but assembling at an factory is expensive. It easily add 50-100.- USD to unit cost at low volumes and I don’t have the financial backing to go high volumes.

One alternative is to use an Asian factory, rather than the expensive Norwegian ones. They differ a lot on low volumes. The other alternative is to invest in equipment for low volumes yourself. Acceptable Pick & Place machines and Stencil Printer solutions exist from ca 4000.- USD. It is specially 2 machines that caught my attention: CHMT36VA and TVM802A. These are close to identical in functionality and price.

 

The pictures above is CHM-T36VA and CHM-T48VB. The difference is that the later have PC embedded (Linux) and 2 x as many feeders (58) and cost ca 5000.- USD compared to 3200.- for the smaller one. CHM-T36VA need an external PC. CHM-T48VB really is a good deal.

The key with these machines are that they have cameras capable to calibrate components giving them a much better accuracy that previous low end solutions. Their limit is that they only have 2 heads and 27-29 component feeders. So for more advanced electronics you will need to swap reels and nozle’s etc. They are also decently noisy and somewhat slow, but they will do the trick.

My reality is that I spend a huge amount of hours soldering proto-types and these machines can do that much faster and more reliable where I only solder on hole through and special components myself. And once the machine is set up I can easily produce a decent number of boards close to automatically. More important is that it will enable me to work with BGA style components.

Another cost is components. I basically need to invest in a decent stock of reels, meaning I will need a much larger stock of components. IC’s are different as the machines can pick them from trays and you can buy lower volumes. But, it is doable.

The design of a low cost Pick & Place machines consist of several main components you need to evaluate.

  • The CNC frame with various axis and tools. This needs to be low noise as well as very accurate. The size/speed also decide prod volume.
  • The feeders enabling the machinery to pick up components. You want as many of these as possible and a combination of Reel, Tray and Tube-feeders.
  • Calibration cameras. Early machines did not have these and did decently well, but with camera’s you get automatic calibration on Components and avoid errors that was common in early machines.
  • Placement heads. The smaller machines have 2 heads, but you really could need more as different nozzles are needed for different components.
  • Control system on these are a combination of sensors, stepper motor drivers, camera inputs and usually a PC level computer to add Logic.

The challenge is that increasing number of feeders and heads also increase investment cost. I think 3.200,- USD is as far as I am able to go for now and I really like CHM-T36VA + I have plenty of PC’s and screens around.

New 3D Printer

I do at present have 8 PCB’s + 3 designs I have not ordered yet in my modular control system, so I have a far to large backlog of electronics that need testing and code. The difference with my last 12 x PWM Hat is however that it target a project – my upgraded 3D printer.

I purchased a Prusa i3 which basically is a clone of a generation 1 design and I want to use my modular control system on this one. I actually have 3 Arduino based control systems of which 2 used a fake FTDI chip that caused problems. But, I want to add features not available in the old control system.

Multi-material support means more than one extruder. This is mostly a mechanical re-design, but I need extra Stepper motor controller and logic to handle it.

Automatic calibration. Those of you who have used an early version of a 3D printer know how much work that goes into calibrating and ensuring that the printer is correctly configurated. This can be done automated by sensing the tilting of the plate using a “Z-Sensor”.

Torque based end-stops means that I do not use end-stop sensors, but sense current increase as the CNC machinery hit mechanical stoppers. This is goodbye to a lot of problems and wiring.

In the illustration above I assume I will use 5 modules to make a modular control system. One Wifi module that can be Raspberry PI or ESP32 based, a XPortHub to access USB, MMC and HMI. MMC can be used to spool jobs. A 12 X PWM used as 4xStepper to control X,Y and 2xZ Steppers. A 2nd 12 x PWM to control 2 x Extruder feeders and 3 x temperature heaters for heatbed and extruders, and finally a 32 x IO to get temperature sensors and a Z-distance sensor. This is just an early illustration.

The Z-distance sensor I want to use is a small laser that can sense the distance from Extruder to the plate. This can during calibration sense the tilting of the base plate and adjust G-Code parameters so it get correct.

This is an excellent test bed for my modular control system. It is so many excellent All-In-One systems for 3D Printers and my favorite is the new MK3 from Josef Prusa so we could have done this much easier. But, I need a test bed and this is an excellent start to drive development.

High Side Current Sensor

I decided to Change the 12 x PWM Hat to use High Side Current Sensors. Below is the schematics of the new sensors. This means I measure current out on each PWM signal.

Using high side sensors actually simplified the routing so it was a straight forward change. The reason I started with low side sensors is because that is straight forward for DRV8313 and more common for 3-phase. It would have been ok for Stepper and DC motors, but it made it difficult to measure current if you used a single PWM channel stand-alone.

12 x PWM Hat

 This 12 x PWM Hat have 12 x high side current sensors. The PWM driver have a separate PSU, DRV8313 is rated 60V and INA194 is rated -16 to 80V so they are not that easy to break giving the Hat a very decent protection level. A separate TVS and capacitor bank on motor PSU will in addition suppress unexpected spikes + there will be larger protection on the PSU itself. I feel quite comfortable with this design, but testing will show.

Connecting the current sensors low side is not the most optional for individual PWM signals, but it is ok for 3-Phase and Stepper Motors where I wanted them the most. The challenge with PWM is that current mostly leave high side out and get connected to ground, meaning we never pass a current sensor on low side. But – again – I do have a SW trick that I will test. Adding these low side was most straight forward due to DRV8313. But, I will actually evaluate if I should move them high side. This would actually simplify the PCB – I think.

I am looking forward to work with this one due to the advanced functionality you get with current sensors – and if anyone wonder the first project is actually my 3D printer. I will write a separate article about that later.

3-Phase/Stepper/RPM Hat

This Hat was actually a challenge to route, but I managed it at the 4th attempt. I am quite happy with the result as well.

  • Raspberry PI Hat Format
  • STM32F405RG MCU, 32bit ARM M4, 168Mhz, 1Mb Flash, 196Kb SRAM.
  • 42Mbps backbone network. ca 30Mbps With Raspberry PI.
  • CAN Network
  • USB
  • Separate PSU for PWM
  • 12 x separate PWM signals, ca 1A each.
  • 3 x Stepper Motors 2,5A
  • 4 x 3-Phase Motors 2.5A
  • 6 x DC Motors.
  • 24V design capable to support 48V with some cap/diode changes.
  • 24 connector terminal block with 12 signals and 12 ground connections.
  • 12 separate current sensors.
  • 12 separate Half H-Bridges allowing a very flexible usage.
  • Based on DRV8313 3 x Half H-Bridge Driver.

I have many designs, but the flexibility of this one is in a category of itself.

  • Gimball controller
  • CNC/3D Printer controller
  • Running DC Motors/PWM signal up to 10A by combining ports.

I must also admit that it feels good to be finish with this after so many failures on routing this very design. I have done many weighted compromises here, so I will need the MCU on this one, but it will be fun!

My motivation to do this one is that it is a key component in a very special control system where it is possible to actually earn some money. But, well – I can’t tell every secret in here 🙂

PWM Noise

The 2 blue signals crossing the bigger, red Power lane is asking for trouble. The blue lanes are 0-3V ADC signals, while the power lane is feeding PWM MOSFET’s. What will happen is that PWM noise from current spikes will jump over to ADC signals and create a false current signature.

But, I believe it is to my advantage that I have a fast MCU and no electronic filtering, meaning I can apply smart filtering in SW using the high sampling frequencies available on the ADC. Well, we will see. But, I have promissed myself that I will look into 4-layer PCB designers after this one.

MCU Factory Rejects

I must admit that sourcing for STM32F405RG is an issue. I have bought batches from China and I am rejecting a lot of MCU’s. The worst is actually the time to solder them on before I can test, so I seriously need the tester shown in my last article.

This is worst as I like now deal with a new board. I have soldered on 3 different MCU’s that all show up with failing memory sectors, and it’s a lot of stress on the PCB so you can only solder on/off so many times. After 3 fails on a new PCB I also start questioning other possibilities – do I as an example have a bad SWD on this board? SWD is a bit sensitive so if you have a bad SWD connector it might show up in various forms.

I managed to find a good tester for 44.- USD, so I am looking forward to that one. As much as I would like to test new boards I don’t want to waste more time on MCU unsecurity, so I will wait for the tester. I want to know that my MCU is good before I put it on.

I do however still need to sort out sourcing for STM32F405RG because this is unacceptable. But, with a tester I can actually test the batches I receive and slam down on bad sellers instantly to get my money back. I don’t expect the MCU’s to be perfect, but I expect them to work. This is prototyping and you can’t use my sources in production. But, I am getting rather pissed of with fraud schemes of selling factory rejects through Aliexpress! STM32F405 is specially bad for some reason.

I do however see that Farnell/Element14 sell this MCU for ca 9.- USD each in quantity of 10 delivered “next day” inside Norway – it is 2x my current cost, but it is tempting because of the time I waste on this.