Makerbase Pro is another USB/CAN Adapter. This cost <20US and comes with Isolated CAN and CAN-FD. I have just ordered a few of these so will return as I hack a C# API on this as well.
I bought a few of the cheap Robotell USB-CAN Adapters fro Aliexpress and finally decided to use them on a project as I needed a low-cost PC-CAN Adapter. Someone will recall I made USB/CAN Adapters some years ago using STM32F105, but I had so much trouble with those that I never used them. I have on the agenda to create a proper isolated one using STM32G431 that can support CAN-FD, but that is for later. The first challenge with the adapter below is to find a driver and doxumentation – once that is done the adapter was straight up working.
Documentation : Robotell CAN-USB interface – python-can 4.2.2 documentation
For test app search for “RobotellCANMonitor”. Myself I don’t care about Python code as I want proper code in C++ or C#. The USB is a serial port in this case that will install directly on most PC’s – it did on mine. The USB is in this case just a means to connect to the PC, so for all practical purposes it is a serial port. I use C# a lot for top-side so it makes sence creating a C# driver. As for top-side tools I need two – one is a test tool using the driver and USB_CAN to communicate “CAN” to the devices, the second is a CAN Analyzer.
My initial test setup is two adapters in loopback as I write/test the C# driver. Writing a CAN Driver we need to start by normalizing the API because we don’t want a different API just because we later change the adapter – the interface we want is CANbus:
The USB/Serial thing in the middle is just a link, so we want to insert CAN in one end and get the same CAN message in the other. Robotell uses a byte frame as follows:
Note that if the array consist of 0xAf, 0xAA or 0xFF another oxA5 (Frame Control) must be inserted in front.
Note:As I receive frames the tart mark is 2 x 0x3F. To loop the same message back I must modify these to oxAA.
Assuming you use System Message you can replace ID with the following:
1 byte CRC
For more details see this: Robotell-USB-CAN-Python/Robotell_USB-CAN.txt at master · nopnop2002/Robotell-USB-CAN-Python · GitHub
This application is done manually, but I will re-generate it from BSA later. The picture shown is a classic demo application for a 9 – Valve ValvePack. You control 27 PWM signals and 13 analogue signals in this example with 9 proportional 3-Way Valves. These are quite common in subsea systems used in the oil & gas industry and is basically a small SCADA system. I used ca 700 hours making this in Qt/QML and less than 100 hours to re-make it in C#. Once I can generate it from BSA we probably talk about 2-3 hours of work in comparison.
The demo above lack the required Modbus protocol that probably is another 100 hours since I have made it from scratch – I decided to make my own because I wanted a full protocol created in a specific way to support BSA. I have made the protocol, but need to integrate and test it before this package is operational. Modbus also need to exist as both client and server in both C++ and C# supporting ModbusRTU, ModbusTCP and Modbus over TCP with variants.
I need to point out that the comparison 700 versus 100 hours are not exact or 100% fare, but it is an indication of the difference between using Qt/QML versus C#/WPF. To re-do this from BSA will drive development a bit – so far it has forced me to add a lot of controls I will be integrating into BSA.
The actual BSA application will contain the bulding block – gauges, while the Valve Control is a control we make in BSA and re-use. Doing this is WPF is a bit more work than doing the same in Forms and BSA will be closer to Forms. But, more important is the logic behinc the controls that will be visual diagrams and part of the re-used controls as well. Working with HMI it is easy to forget the invisible magic behind the GUI that account for a lot of hours.
On C#/WPF most of the hours was on creating basic controls. That hours was probably the double in QML – QML is a bit more slow to work with since you lack a functional visual designer. But, it is the integration to the backend that made the huge difference in this case. In C# you deal with C# all the way. In Qt/QML you deal with 4 different languages that interract.
In BSA however you just draft a design consisting of design diagrams and press a button to run the system. It should be very easy and very fast, but I am not there yet…
Just playing around with a Torque Tool Gauge. Bit work in progress, but using a wide band as needle rather than a classic needle and due to how my gauges are build up I can easely get them adapted to various stiles. This provides 4 gauges at the space of one – a bit work in progress – playing with ideas.
I made a huge amount of components in BSA, but decided that I needed the components as a stand-alone library and be using them manually in C# before I let BSA generate code and use them in applications. Building a Gauge library is fun.
I finally got the two tank belts designed and added to the frame – so will get around to mount the plates and wire the machine. The tank belt at right hang a little so I will mount a holder to lift it up a bit, but otherwise I am good to go. My current “lab” is an old bed-room, so I need to clear the proper lab in the basement again before I start designing the cabinet for the machine.
I find designing with FreeCAD very easy once I got into it – very funny to design and print your own components. The picture don’t show the holders very well, but it is basically just boxes with screw holes ready printed using PETG plastic.
Finally got around to design holders for my Nema8 Nozzle head + I added a damper between the Nema17 and the head to reduce noise. I need to design tank-belt holders and I can start assembling pneumatic tubes and control system as I should have all parts by now.
I used FreeCAD to design these brackets. FreeCAD works, but it is a lot of bugs so you need some patience to use that in it’s current stage (version 0.20.2) – but, I am looking forward to new versions of FreeCAD + I need to learn more about it.
One of the things I want to do is to redesign the PnP Head completely. I work with Robotics as a profession and while this design is working I also see a lot of potential for mechanical improvements. As mentioned before I want to achieve 0201 quality and to do so I need to improve the mechanical accuracy/stability of the design. The white components above is PLA, while the black is PETG – a stronger type of plastic – but in the next design I want to avoid plastic on critical parts that will wear with movements. This is a machine with moving parts – it need to move fast and with some strength. The plastic design will work fine for a short period before it starts to wear out and not to mention that it will need constant adjustments. But, this is things you learn as you build one of these.
I also want a head with 4-8 nozzle tips on + I am very sceptical to the belt driven mechanism above – I suspect it will strugle with changing nozzle tips because you need some strength to click the on/off, but lets see. I will upload the changes I do to this machine, but contact me if you want them now.
I did notice that someone had dropped the adapter (in white) on top and made a non-turnable adapter – I will advice against that – that is 40.- USD that you do not want to save as the Nema8 will twist the pneumatic tubes and cause them to wear out fast.
Also remember that the z-gantry needs oiling from time to time.
The drawing above illustrate the current frame design with 4 x 2020 aluminum profiles (V type). I considered going up to 3030 or 2040 etc, but I do not have an issue with the strength of the profiles – I do hoverer have an issue with the entire frame moving a bit. So what I want to do is to double the width of the frame as follows:
This will increase the Y gantry to 1200 mm and stabilize the frame at the same time. To do so I only need to buy 3 x 2020 profiles that is 1200 mm long + 1 extra 600mm profile. I think this will do more for stability than adding larger profiles. Using the extra sis is an issue because I seldom need feeders – as most hobbyists I use strips and components in trays – I need the extra space to put this on and this is a low cost and very effective modification I think.
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.
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!
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.
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.