PnP Head

I am building a PnP Machine based on lumenPnP (an OpenPnP) variant, but as I lack many of the specialized parts they use I have to make changes. This has been a great project as it forced me to lern how a PnP machine works and what challenges it included. As I upgraded to version 4 using rails rather than the rubber wheels I also started thinking about how to add more heads. This machine has two heads, but I want the scalability to add 4 or 8 heads, so I designed a new modular PnP Head. This new head consist of a holder + Camera fixed on the rail where you can mount PnP Heads side by side and even on both sides.

The work is not finished, but it starts to look great as the new heads are compact and modular. But, adding more heads to a PnP also require additions to the control system as each head need two more stepper drivers, a pump driver, a solenoid driver and extra sensors – so I am still sticking to two heads for the time beeing.

 

BSA – Version 0.9

I am getting closer to finishing a Beta version of BSA as a pure Modeling tool. It helped a lot starting to use BSA on a PLC project and the visual dictionary UI is a step in the correct direction. What you see below is one of my remaining bugs. I removed connection points after some testing, but the lines below is still computed as if CP’s are precent. I Only need to click on Actuator and move it forth and back and lines are corrected, but it is a very annoying error. As I save the diagram and re-load it the error is fixed so it is only minor.

Dictionary organized to show main diagram content is a step in the correct path. Switching to the alpabetic content list (below) you can see the example BSASymbol – I now get BSASymbol + a clear indication of precentations of BSASymbol. All in all th dictionary starts to function as a navigator, but it still lack some critical functionality like the capability to drag existing objects into a diagram.

My first objective was to release a UML Class modeling version, but state diagrams and PLD is also included now. What I do lack is a UI to import/export between precentation classes and the original entry, but having the freedom to draw as you pleace is important.

The weakest part of this release is PLD that will need a bit of work before it is fully functional, but as is it is great as an addition to a UML State diagram. I don’t think PLD will be completed before I start generating code. It is a matter of actually coding with PLD on real examples and see what is missing. I am working on a PnP robot and need to modify the existing firmware (C/C++) so it could be fun to test that up against BSA. It is specially the G-Code engine that I need to work on. I think a few projects that drive the last bit of development will be needed because it is not possible to see what is missing otherwise.

But, lets focus on dictionary and integration between diagrams first – PLD modeling and Code Generation is next.

 

New PNP Head

I borrowed the design from LumenPnP (an OpenPnP variant), but I am honestly not impressed with their mechanical skills, so I re-designed the head. Firstly I needed a different end-sensor and added one on each side. But, the major issue was the blue belt holder that difficult to print and would not fir the belt I have + would not fit my stepper. I was also sceptical to the green middle component, but FlashForge printed that correctly.

The first LumenPnP design lacked tank-belts + it used rubber wheel on the gantries – this is now corrected as the new design is using linear bearings. I am doing a little trick on the end-sensors as I am changing to standard optical sensors that are available on AliExpress.

BSA – Dictionary

The Dictionary part of BSA is quite important as your project grows because it is instrumental in keeping overview and re-using components. The content is always the same, but I decided that I needed at least two precentations of the Dictionary content that is selectable by buttons on top of the Dictionary folder itself. You see examples below and this is not written in stone. The first organize content by diagrams, the second list content by category. The actual project below is just a mock-up used for integrity testing.

Names and terminology will need to be consolidated + some more testing and this Beta is ready to go.

BSA – Communication Link

BSA contains a build-in component “Communication Link” and I wanted to see how it would be to code this manually in BSA. As you code you can chose to code modules in target language , or you can code components in BSA itself as we do in this example. See discussion below the diagram.

In this case we assume that the host platform have an object “Serial” with Open and Close functions as well as an event “Serial.Error”.

Open is straight forward as we open the serial line and exit with OnOpen or OnClose. Same with Close we exit with OnClose.

The more interesting part is the event “Serial.Error” where we call Close, wait 500ms and call Open three times before we give up. This is designet to keep a serial line open. Open is the same diagram as we have on left, but we override OnOpen and OnError in the “Serial.Error” diagram – if we get OnOpen we forward it, if we get OnError we loop and try x times before we give up.

This should work just fine, I will not advocate that everything should be coded in BSA as that is an user choice, Myself I will code large libraries in C++ and C# and glue them together in BSA. To make this a library you just select the diagram in the dictionary and tag it as library with a version number or you can just re-use it directly from Dictionary by dragging it into the diagram. It is guaranteed to be details and changes on this bit as we go into code generation later.

The same diagram through the clipboard – I thing “someone” has forgotten to convert colors for a component đŸ™‚

BSA – Assign statement

I am using BSA myself daily as we speak and this sometimes makes it very obvious that some of the functionality needs to be improved. I was initially very happy with my Property Editor (at right), but as I have worked on large 4K screens I have noticed that text gets very small and hidden far out on the right side as I write text. As I in this example write a small block of PScript I alsi notice that the editor is rather limited to work with.

The small function above receive one of two signals and make a calculation that either raise an Alarm or a new signal. This is perfect for the Assign statement to add a few lines of code directly – and yes it works. But as I write these few lines I also notice that the small text editor in the Property Editor is not very well suited for this. I will put this on the list, but it will have to stay as is for the first Beta elease.

PLC – ADC Readings

One of my concerns on 600V design is how to make ADC readings in the 600V area.

I need 3 x Current sensors, 1 x DC Voltage Sensor and 1(2) x Temperature sensors in addition to support for up to 3 resolver sensors as well as an external motor temperature sensor. That sums up to 10 ADC readings coming from or through 600V area. I was investigating ADC to SPI solutions, but specially current readings will happen 25,000 times per second and needs to happen at exact timing. I did find component that do specialized current or ADC readings with isolated ADC output, but those ADC signals will be measured on the far end of a PWM card and needs to be transported to the MCU. The solution I decided to try out is a 2-barrier system. I use an isolated sensor capable of handling xx Voltage ESD andthen a 2nd barier with an Isolated OpAmp on the Controller.board.

I am no expert on this so it will need to test. Calculating cost I am looking at 6.- USD per analogue channel assuming Digikey prices at 10 x. I think the first test is to make a small board testing a single channel to see if this works and what delays and reading quality I get, As for temperatur and accuracy the current sensors will have the same error and drift from temperature so the angle should still be intact + PID + Filter will regulate that regardless.

I will add a MOSFET set on the test so I can load a single channel and verify if my heat calculations work, but I am not that worried as we talk about only 10A on the first board, I did calculate ca 12Watt loss using decent MOSFET’s from Infineon with 105mOhm RDS.

STM32H503RB

This MCU started to interest me because it is a low price alternative with a lot of contents. ST’s price is 1.7 USD, but that is 3++ USD through Digikey in low volume. It is a 128Kb Flash version, but it has a promissing build-in Bootloader that I want to experiment with. If you build a CANopen bootloader you easely need 64Kb for the bootloader alone unless you want to spend a lot of time in size optimization. You can get a bootloader down to 8Kb, but the cost in time is usually to huge so I just use a MCU with more Flash. This one looks like I might keep 128K Flash to applications making it a very interesting low-cost option.

  • 32 bit w/FPU at 250Mhz.
  • M33 Core with lots of extras.
  • 128Kb Flash, 32Kb SRAM.
  • 1 x FD-CAN
  • USB
  • I2C, SPI, UART in 2-3 x.
  • One decent Motor Timer.

And some extras that I basically don’t know what is yet.

I have ordered a Nucleo board and 10 chips as I want to consider this for several projects.

Java programmers hit again

I am used to problems with STM32CubeIDE – this one popped up as I wanted to open the ioc file of a STM32H503RB – it is a well know error from Eclipse based tools – or more correctly Java based tools. You can always recognize Java since the code is slow as a slug and then you get these ones in your face!

C# suffer from many of the same issues as Java – one of them is the exception mechanism. I have made my arguments before why I consider that a notorious unsecure mechanism in any language. Myself I avoid raising exceptions, but I do catch them and ensure the code can continue. A crach like this is unacceptable! And lets talk about performance …

The rest of the IDE is ok the times it works, but the ST’inherited Cube is sloooooooow – I spend a lot of time looking at the dialogue above. And Java is actually not that slow, you just need to know what you are doing. And finally after struggling to close Eclipse we can start over again and after a loooong, slooooow opening sequence we are rewarded with crap that works on a good day.

Eclipse and specially Atolic Studio that we know as STM32CubeIDE is actually decently great to work with – and the CubeMX additions are also a great assistance in figuring out how to wire a MCU and generating HAL’s as well as including libraries. But it is slow and as seen above – still have bugs.

PLC – Motor Controller 2

Most of you have already seen my main PLC Core board with 3 x CAN ports and 10 x Extension ports. What I plan for the MC is to extend this to 4 ports wide, keep one CAN port and add a 24V power port, replace the MCU with a smaller Rx (64 pin) version, add a TTL UART  and motor logic electronics, The 10x UART ports will be replaced with one. This can then be the single extension if you want to add 4 x CAN ports.

If I have available TTL UART ports I will add them if I have space, but the Motor Controller will be packed – which reminds me that I need to actually build the board above as well. Give me two weeks and I will have one made. I reduced the scope in the drawing below because I wanted a clean Motor Controller. The single TTL port can link to a PLC Core that includes as many add-on’s as you want, but the MC should not be the PLC Core. It is also an issue about how much I can get on the controller board as it needs to hold a lot of extra electronics.

MCU – I will drop down to STM32G474/G491 or even G431. I could also consider the new STM32H503RB due to cost.

GateDriver’s are selected as ST have some vith full isolation and 1200V tolerance to a decent cost.

Current Readings the same – I found some very nice 600V tolerant earlier, but these will be on the driver board.

Temperature Sensors – I have to find a solution.

Resolver Input is 3 x ADC’s and I have to find a solution.

CAN, UART, SPI Flash, SPI FRAM, SWD can be copied from the board above.

MOSFET – I need to find some nice 600V with ca 20A and a low cost/low RDS and low sitching times. I will find some that work well from 48V to 400V.