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.

 

 

RISC-V CH32V307

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.

KiCAD Bug

I was warned ny JLCPCB that my boards had some strange pad’s – looking at KiCAD I notice the issue above. These via’s are set to have Pad on connected layers only and KiCAD screws up. If I click on the via it correct itslef. Will be interested to see if this board works at all. JLCPCB offered to redo them, but I will just leave it for now. I will test if they connect as they are supposed to, if not I will redo them. The Ethernet module and motherboard should be ok – the PWM3 and PowerServo2 will have this issue.

PnP – Part 2 – Identifying and ordering parts

Identifying and ordering parts is difficult because the part list is not fixed. My first thought on Camera modules was that I needed to go for expensive, high quaity cameras, but reading tells me a 720P camera is sufficient and that higher resolutions just makes the process slower. Anyway – I decided for some 10.- USD camera modules from GXIVISION because they have everything from 1MP Camera to 16MP camera in the same format – this is USB and UVC Compliant, meaning they will fit Windows, Linux, MAC etc + the modules are easy to mount.

What lense to use? No idea – I ordered 1.3mm, 4mm and 6mm – will see if I can get som extra lenses that cost ca 5.- USD each. I probably spent 50,. USD on cameras – twice as much as I would have needed because I want to experiment. I will provide a more detailed BOM and reference to parts I use later.

I still need a few parts and have a total PO out for just about 400.- USD – actually very good. But, I more or less expect to miss some out meaning I will order most parts now and have to re-order a lot as I start mouning in ca 6 weeks time. This is a learning process

PNP – Building an OpenPNP machine – Part 1 – Getting started

I recently started to look into OpenPNP and decided to build my own Pick & Place machine! I will base the machine on LumenPNP (or IndexPNP as it also is called), but I have already started making changes of my own based on what I see done by others. The first job is to understand how a PNP works so i know what I am doing – that is actually an easy job these days due to all the folks posting hours by hours of youtube movies building one. So, here I am having ordered components for a pick and place machine that will cost me less than 1000.- USD.

My primary objective is a machine that can achieve 0603 components and build my prototypes in a hours rather than me sitting here days soldering prototypes manually. My secondary objective is to achieve 0201 components and a small prototype-production line.

First things thirst – before you start a project like this you need to be prepared for a few days of watching youtube and learning from others. Watch, learn and make up your own mind. You can’t just build and hope for the best, you need to understand the impact of the decitions you make – and the key question is – why is it hard to achieve 0201 components? If you understand why you also know the solution! Below is a picture of LumenPNP borrowed from their website found here LumenPnP (v3) – Opulo

This is a classic OpenPNP machine with many custom changes/improvements and you can buy this as a kit for ca 1800.- USD. I have no opinion if this machine is better/worse than other OpenPNP machines, but it was key to get me started. The entire project is on github and they use FreeCAD for 3D, so it is good as start as any other machine I guess. But, what is wrong with it? Why can’t it handle more than 0603/0402 components ? Bare in mind a majority of older machines or commercial machines also struggle with 0201, so what do we need to do different?

My first choise was to use NOKI Noozzle rather than Samsung CP40 – the main reason is because NOKI actually provide a nozzle capable of handling 0201 components + it was decent cost and seems to be far more used by makers. But, having a nozzle that can handle 0201 is only the first step. A far more important decition is the robustness and accuracy of the CNC machinery – which in case of LumenPNP have made a few decitions I do not like – that said I ordered parts before I realized so I will build this as is to get started.

Examing the pictures from this and some pictures of other machines you will instantly notice the lack of steel, weight and robustness – don’t get me wrong – it looks very robust, but to achieve 0201 you will depend on a machine that do not move at all. This machine will need some weight added. I might also considering adding a more robust frame or even weld a custom frame, but that is for later – my first point is the work-plate – I want this different to cover the entire 600x600mm frame. As pointed out in some videoes the frame also move a little, so I will add a 15mm tree plate supported by blocks of tree under to prevent any movement and add a thin work-plate of aluminium (or something) on top of that. This will add weight and give me a much larger plate. Obviously I also need a plate at the very bottom that can host a possible cabinet (above and under) – I can easily build a glassed cabinet later to prevent the machine from dust.

A more important decition is about accuracy of X,Y and Z axis. The current design uses belts, while it would be very easy to replace those with long metal threads and steppers that drive the threads. The advantage is that the thread act as a worm-gear giving a more accurate, robust and steady movement – I think this is one of the key changes needed to achieve 0201. But I also want to look at camera quality and designs.

Lets see what we can achieve – A PNP is at the end only a CNC machine and the accuracy and robustness of it’s movement is doomed to decide the accuracy of the entire machine IMO. I also believe that having a clear opinion about how to achieve 0201 is half job done – that said, I have never build one of these before!

As for now I have to wait 4-6 weeks on parts – I had some from before, bought parts for 350.- USD and probably need to spend another 300.- USD. So the total price will be closer to 1000.- USD for a machine with a single head and no feeders. As a hobbyist I am not so conserned about feeders because I have very few rolls of components – a strip holder will do fine. A single head means a slower machine with nozzle changes, but again – that’s fine for an entry level machine.

 

 

BSA – 4 Module Motherboard

The 4 Module Motherboard grew to 51 x 100mm as I decided to add the power connectors (seen on right above) outside the module area. You can also see two 5V regulators on the motherboard. Each SPX3819 deliver 500mA and I can feed of 6-8V or 12V with jumpers, but I could also add a small watchdog with 4 x SPX3819 and capability to switch power on/off on each module. Regardless this motherboard is a proto, we can modify it later.

I might create a new version later with a watchdog and power on/off relays on the side – space under will be to tight, but I can switch on/off 5V using 4 x SPX3819 regulators. For 8V, 12V and 24V I need proper relays and drivers for these. Power lanes on the board is a bit tricky as well. I benefit from using 4 layers here, but I am not sure about high speed RS485 and CAN-FD from board to board. We will find out. CAN-FD and RS485 connectors can be added to the other end for 1 module or 2 module motherboards. I need to make the 1-module motherboard to support stand-alone modules as a minimum. Not sure about 2-module yet, but I do want larger motherboards.

PLC – Chosing a cheap, small MCU

My first choise for a MCU for the I2C/SPI Adapter card was STM32F042F6 since I have 4 of these in my stock, but buying these now is a nightmare. Looking at MCU’s I really would like to use STM32G0B1KE, but price difference between ST and Digikey is a 3 x. so what I decided to fall back on is a prototype made with STM32F105Rx MCU’s. I purchased a lot of these some years ago and I need to use them for something. These MCU’s was purchased from Aliexpress, so I might be wasting my time – but, this is for a prototype I can optimize later. Using a LQFP64 rather than a TSSOP20 is a big difference in size, but it will do as a prototype.

The only know issue I have with these MCU’s is that I have not been able to get USB working and while ST say these are 64K I believe mine is of the older 32K batch – but, who cares. They have CAN, I2C, SPI and UART and plenty of juice for this job + I get rid of my stock of 50 or so STM32F105Rx MCU’s – which are too expensive these days!

I can get hold of STM32G0B1KE MCU’s that are 7mm LQFP32 size, but for a price closer to 8.- USD while ST give budgetary price of 1/3 of that. Digikey gone greedy. I bought STM32G491Rx earlier this year for ca 8.- USD, while they now cost 12.- USD on Digikey. Digikey is quick and reliable, but their pricing are extreme these days. I do hope the current semiconductor shortage will come to an end.

One of the drawbacks with these older MCU’s is that you need external crystal. I attempted a USB/CAN converter with this MCU some time back and never got USB working. Firstly I did the istake of not having a crystal, secondly it just never worked – that said I never tried to much either so I don’t know if this was bad batch or design error or something else. I would primarly like to use CAN on this adapter, so I think it is wise to dig up some old cards and see if I can get CAN working first.

The MCU’s I got is mostly RB which is 128Kb Flash, but I also have some 107Rx and 105RC that are compatible. Adding a LQFP64 I probably have space for both CAN and RS485 – it will be nice to use up this stock anyway.

PLC – I2C/SPI Sensor Adapter

My next module is a TOF sensor that detect distance to objects, but those modules are based on I2C and I might need some distance between detector and PLC, so I have 2 options.

  1. I can move a PLC module close to the I2C device
  2. or I can use a separate RS485/CAN Interface.

It sound a bit overkill to create a module that basically convert RS485/CAN to RS485/CAN, but the RS485/CAN on all modules are IPC designed for high speed, short range that don’t need isolation. If I want to communicate with adapters 2-5 meters away I need some isolation, power and slower speeds + I would like to connect to multiple devices. I use RS485 in this example because that allows me to use cheaper MCU’s on the Adapter. CAN is more ideal, but harder to align and require MCU’s with CAN Interface. That said I will create both because I like CAN.

I2C or SPI on the other hand is TTL logic and will not survice mutch cable dispance.b Below is a typical Laser/TOF sensor with I2C.