PnP – Attention to details

I ordered CNC belt driver wheels a bit quick and realized just now that their hold is 6mm while the shafts on my steppers are 5mm. The extra 1mm meakes a “hump” as the belt move and the combination is not a nice, smooth belt drive – so new belt wheels have been ordered. I am still waiting on tubes anyway so it will be february before the PnP is running. But, ordering parts from AliExpress used to be 8 weeks while it now is more like 2-4 weeks. Things have improved. I have to pay tax on everything, but all this is nicely organized from AliExpress. That said – some parts are cheaper on the local hardware shop.

BSA – Save/Load

As mentioned before it is easier to blog about HW than SW, more to show. But, that is about to change because BSA is very visual once it runs. The screen below is just a demo/test for Save/Load functionality and once that is working I can easier blog actual about diagrams. I must admit it was nice having a short break from BSA because this project have lastet 1,5 years now and it is a lot left todo. But, I do hope I can have a consistent demo that you can download sometime in early 2023.

1-2 days more and Save/Load should be working, meaning I can start on an example code generator next. The way to test save/load is to create something, save it and then load it to see if it is loaded. And then I save it again on a different file and compare files. I also add a lot of integrity testing as I load – in case of any error I decline to load with an error message. The saved file is XML alike so the user can edit it manually.

In the future I will add JSON format as well, but XML was easier for nw since I had a tailored parser already.

Happy x-mas and a happy new year!

PnP – Noozle Head

This picture (above) show the PnP Nozzle head. (1) A Nuki 506 Noozle, but I have several noozles. (2) A noozle holder. (3) A Nema8 hallow shaft Stepper and (4) And adapter for rotating hallow shaft to vacum tube. These are some of the most expensive parts of the PnP design. I have received 501 Nozzle that is designed for 0201 components, so we will see how far off we are in mechanical accuracy.

This picture is the entire Z gantry lacking belt and camera. I had to repair one of the adjustment bolts as it did not hold and you don’t need much insight into mechanics to understand that this would be better as metal parts. But, they cost me ca 10.- USD and 30 hours in printing, so they will have to do as a start.

I have 3 cameraes and multiple lenses. I initially assumed that an expensive, high resolution camera would be better, but recommendation is to use 720P cameraes. The algorithm only focus on recognizing position and some parts and higher resolution will make the machine slower (need more time to compute).

These 3-Way peunmatic solenoids was cheap, so I ordered a 6V and a 12V. The 12V is the right size for the job and tubes. These are both small and cheap.

PnP/PLC – Control System

This is an early draft of a new, scalable control system for the PnP and later CNC machines. It is based on my own PLC system. I will re-use an older 3D Print control system or even get a OpenPnP control system in the first place, but I want to replace it with my own a bit down the road simply because of scalability and because this is an excellent test case. Using a modular PLC will in most cases never compete with a all-in-one control system in cost, but it offers doers an option to plug & play and make their own systems without digging into complex electronics and firmware as part of the prototyping.

CAN is a much better IPC than RS485 on machinery because you can have multiple nodes that communicate simultaneously as one system. The design here is to use a Raspberry PI with Displays, Keyboard and Mouse as a top-side for the PnP. The Raspberry PI Module will interface Raspberry PI to the internal CAN.

As for Vacum Pump I plan to re-use the more expensive unit I have so the only interface here is a relay switching 230V mains on/off. I have the alternative cheaper pumps as well.

To control Vacum on two heads you need vacum solenoids that are driven my 6-12V signals. My PWM3 module is perfect for this.

As for Front Panel I am undecided yet, but I will need an on/off switch etc. It is possible that I can switch off power on the system leaving only a low-power module running to check power button etc.

Camera Top and Camera Button is connected to Raspberry PI, so this is on/off and LED drivers – maybe 2 x PWM3 Modues?

Calibration switches is digital input signals. I will need to make a very simple module with protected signals in for this.

Stepper Modules are simple modules with one or two Stepper Hat’s. I will probably make a Single, Dual and Quad-Stepper module. My current PnP have 5 stepper motors since I don’t plan to mount the 6th yet (only single head for now) .

This is just an idea and planning ahead. To actually do this I will need to replace Marlin Firmware with a distributed version – it is very doable, but it will be a bit of work.

As for cost – multiple modules will cost more than a larger single module, but the bauty of this PLC is that I can use both. It is nothing that prevent us from making a larger all-in-one module with everything later and then still be able to expand this as we want. Also – cost of pre-made plug&play modules will always be a cheaper, easier way to do prototyping allowing you to make it work and optimize for cost/volum production after you have a success.

PnP – Back Legs

This picture is from LumenPnP (Opulo) that I use as base and show that they already have corrected the weak mechanical leg, but obviously not updated the open source drawing – or I must have downloaded the wrong ones 🙁

Never mind – I have glued the part that broke and they will do for now because I intend to change this design regardless. 3D printed parts have an obvious extra weakness in the direction they are printed, so if you print this laying down it will become strongeron that part, but notice that part that hold the motor – that would then be weaker and most likely break easier after some use due to vibrations over time.

I did notice that microsmt argue for having metal parts here due to this kind of problems with 3D printed plastic parts and I agree. This needs to be redesigned unless you want to repair your machine on regular basis. Sadly making metal parts is much more expensive. But, buying Aluminium plates are not – and one idea is to make hybrid parts – I want to redesign this part anyway because I want closed cabinets rather than a open dust collector.

PNP – First Mechanical Weakness

The red arrow show both the slice/print direction I used and where this part broke off. This is a corner peace and I needed to print it in two parts – that worked perfectly, but as I put the 2020 frame parts in I also accidentally dropped it to the ground and the piece broke. The design is a bit weak here, but the real cause is because I did not realize that the slice/print direction needs to go the other way to strengthen this exact peace. I then get the exact same problem on the right side on motor fixings – so I will print this separate in the existing direction.

This was a 14 hour print-job and I am almost done with the 2nd part, so 28 hours more of 3D printing to come 🙂

I will also see if I can modify this part to strengthen it because the stepper motor will be on right and cause hammock due to vibrations over time.

PLC – PowerServo2 Working

First I managed to solder on the MCU the wrong way and secondly I did not manage to solder some of the pins – I am seriously looking forward to having PnP machines doing this job, but my first module is finally working after ca 7 hours of manual soldering. Leds and SWD is working at least 🙂

This module was a copy of PWM3 because I wanted something to test my 60kg Servoees with. It needs to be simplified to reduce production cost. I am using a 64 pin STM32G491 here that cost ca 10.- USD alone and will look into replacing that with a 48-pin RISC-V that cost 0.4 USD and remove some components and move the rest to the front side. I don’t need both CAN and RS485 and I can remove SW controlled relays for the terminators by moving them down to a watchdog on the motherboard. I would like to keep CAN-FD, but might degrade to CAN-HS for now. I don’t need the capacitor bank and this as well can be moved to the motherboard. Even the FRAM can be moved to the Watchdog/Motherboard to simplify modules. I need to finish testing on this and do the same on Ethernet/PWM3 + I want to test RISC-V toolchain/IDE before I decide on WCH MCU’s.

PLC – PowerServo2 – half done

One side of the 2 x PowerServo module soldered. No problems so far. I copied a capacitor bank from PWM3 where I used some 0803 capacitors. I have to revisit that because they should be 1206 footprint. Voltage here is max 8V and the capacitor bank is not as critical, but I made a note to add banks on the motherboard for each voltage.

I can’t wait to have my PnP machine mounted – it don’t look like much work, bit it takes time due to the small size.

PLC – Mechanical Test

I paid 31.- USD for 4x 4 layer PCB’s from JLCPCB and they arrived after 1,5 week. The only drawback is that they do not pay tax directly so DHL had to do that charging me another 30.- USD for Tax and Handling. But, I am very pleased with JLCPCB so far. Below is a picture of the mechanical assemble test I did yesterday.

The USB-C on the Ethernet module is to low causing a conflict with the power terminals, so The Ethernet module can only be used on one side. I also discovered a schematic error on the Ethernet module, but other than that this was very much as expected so far. The crystal on the Ethernet module is the wrong footprint and position is to tight for the W5500 header anyway, so I will have to test without this. I have only mounted mechanical components so far and I am very pleased with how the 2.54 pitch headers and modularity worked out. The modules are very easy to mount on the motherboard. This is a very small system. This picture do not give a real impression of how small this actually is, but measure up 25mm x 45mm on a paper and you will see

One of the modules have 80ich components so they will be hard to assemble manually. I am not so impressed with purple color on PCB’s – I will use different colors next time, but the reason I used purple color is becaise I hope to use this on my x-mas tree to blink led strings 🙂

The Ethernet Module becomes a little tower since I used headers for now – I don’t want to waste a module by soldering it directly on yet + I need 2-3 mm clearing anyway so it will be a bit tall. I will make a proper Ethernet module with a low profile RJ45 later.

I do however need to look into production cost on these modules. I mount components on both sides meaning I will need to run two assembly runs and I use five hole through components on each module that require manual soldering – that drives cost, but the worst is STM32G491Rx that cost 12ich USD each. I love STM32, but not at this cost. I have a few options that I want to look into:

  • CH32V307Rx is at a different cost base. It does not have CAN-FD, but it do have a Ethernet w/Tranceiver for 10M. I am considering testing out using that as IPC by having the magnets mounted on the motherboard and adding a 4-port Ethernet Switch on the motherboard.
  • Another option is to switch to either STM32G0xxxx that also have CAN-FD or downgrade to CAN and use the lower end of CG32V that cost < 1 USD. That will save me ca 10.- USD per module. I can re-use the motherboard as is so I will make test boards for this one.
  • I can replace the SWD with a different one that do not require a hole through connector.
  • I can use more space to get components on one side only.

For now I just want to enjoy x-mas and mount these. Luckily parts for my PnP has also started to arrive and looking at these modules I must admit I look forward to be using that. It’s been a while since I did my own electronics so this will be fun.




CH32V307 is a RISC-V based MCU that is created by WCH and that got my attention due to it’s low cost – 3.- USD in quantity 1 and down to 1.9 USD from JLCPCB. I have read about RISC-V as an alternative to ARM for years, but I have not paid much attention to it so far. It exist many MCU’s, but most of them are to expensive to work with for a hobbyist. STM32 and AVR have been the exceptions because MCU’s, tools and toolchains are available at low cost. This does matter because it enables me to use them without the backing of a large company.

WCH should be well known to most hobbyists due to theire CH340 chips.

CH32V307 comes in 3 variants – the LQFP64 version is illustrated above and it is a MCU that is comparable to M4 (F4xx and G4xx) series in STM32 as far as performance and functionality goes. I will argue that STM32 is a bit better yet, but it is several aspects of this new MCU that got my attention and made me realize that this might very well be the next dominant MCU.

It cost 1.9 USD in volume of 1000 from JLCPCB – and even quantity 1 is only ca 3.- USD.

A STM32G491Rx cost me ca 12.- USD from Digikey, so a comparable MCU that cost 3.- USD does get my attention – that said STM32G491 only cost ca 9.- USD from PLCPCB, but it is still a 3x in price between MCU’s that seems to be very comparable.

  • RISC-V vs ARM
  • MoanRiver Studio vs STM32CubeIDE
  • Similar speed, Flash, SRAM
  • 4 Op amps on both
  • FD-CAN on one, Ethernet w/Phy on the other.
  • aso

With 4 x OpAmps, 4x Motor Timers, 2xCAN ports, 8xSerial ports, 2xUSB ports, 1xEthernet w/Phy on chip the CH32V307 becomes a very interesting alternative for many applications. But, it is the low cost that is the killer, and makes me realize what an impact this MCU is about to make – assuming it keeps it’s current price/availability.

I don’t expect the eco-structure on CH32V307 to be even close to what I get from STM32CubeIDE yet – but this is an evolving story. This is changing fast!

CH32V307 have a smaller sibbling – still a RISC-V, 48 pins, only 64KB Flash, 32Kb SRAM and 48Mhz, but it cost around 0.4 USD in quantity of 1000 – making it one of the cheapest MCU’s around.

CH32V307VCT6 development board RISC V core support RT Thread onboard| | – AliExpress

Above is the link to a < 7.- USD dev board available – you also need to buy a WCH-Link Debugger – around 10.- USD is all you need to get started with this RISC-V MCU.