Proudly wearing my Berkeley sweatshirt with my wife Heide's painting in the background. |
The paint flow control system comprises the controller, a flowmeter to measure the paint flow rate, a paint pump, a paint gun and a robot to steer the paint gun and turn it on and off. The flowmeter outputs a 4-20 mA current for the flow rate and the pump is controlled by an I/P converter, requiring a 4-20 mA current. I helped to choose the flowmeter and the I/P converter for the systems.
As I have been saying in previous posts, for the controller and User interface we decided to use a Beaglebone Black (BBB) single-board-computer (SBC) along with a 4D Systems (4D) touch-screen LCD, the 4DCAPE-70T (4DCAPE_70T). I used commercial SBC's for previous projects with K&H Finishing in San Jose and Enclosures Engineering of Fremont and recently had designed my own SBC with analog I/O, Ethernet and Serial Communication capability but Vivid and UEI wanted a commercial board for this project, preferring not to manufacture a board. So I had planned on using a BL2600 SBC from Digi International (BL2600) for the control and a notebook PC to communicate with the BL2600 and provide a GUI for the operator. However Thomas Nguyen, my cohort at Vivid, suggested using a touch-screen LCD panel instead of the PC in order to simplify the system for the User. I searched and found the BBB and the 4D Systems 4DCAPE, figuring that I could do the whole job with those two widgets and thereby greatly simplifying the control system. The BBB has an onboard Analog-To-Digital Converter (ADC) for measuring the current from a paint flowmeter and has a Pulse-Width_modulation output for providing a control signal to control the pump speed. It does need some interface circuitry to convert the 4-20 mA current from the flowmeter to voltage, a resistor, and an operational amplifier and transistors to convert the PWM output signal to a 4-20 mA current to control the pump. So I got to design a little board for those purposes, using Kicad (Kicad), a freebie CAD software package. Kicad has its idiosyncrasies as all CAD programs do, I suppose, but I have found it to be usable and the Kicad user group is quite helpful for beginners (Kicad Users).
I had been working on a simulation of the system using Python (Python) and decided to continue using Python in the BBB for the control code and also for the GUI. I like using Python since it's a faster development process, not requiring the usual compile and link and do over and over until you get it right. Python is an interpreter so the programs run slower than a C or C++ or C# program but the slower speed is not a problem with the paint flow controller since the process is very slow. In order to produce a GUI for the operator, I used Tkinter. That has been something of a problem, giving me fits with a Tkinter error that I mentioned in the last post. However, my code can be run by connecting a keyboard to the BBB thru its USB interface and starting the code with "sudo python myProg.py." But certainly that's not adequate. I can't require the users to have to type in a command to get myProg.py up and running since those guys or gals are in a manufacturing environment and probably in Asia. They would like a simple button to press. If possible, it would be nice for myProg.py to start up on booting the BBB.
So I set about finding ways to start my Python code with a button press or touching a "button" on the 4DCAPE screen. I found that there are three ways to do that:
- systemd
- cron
- icon on desktop, Debian or other Linux.
Lots of info on systemd and cron is available with an Internet search, so I won't repeat it. I tried and tried to get either of them to start up my SimB.py Python program but wasn't able to do so. I think the problem is the Tkinter error that I mentioned above. However, with the help from a post by Cyril Laury in this askubuntu post (Icon StartupDesktop Icon), I was able to put an Icon on the Debian desktop and have it call a bash script to start my program. Here are the scripts.
paintflow.desktop
[Desktop Entry]
Version=1.0
Exec=sudo /home/debian/Desktop/startcontrol.sh
Name=Paint
Comment=Start up SimB.py
Encoding=UTF-8
Terminal=false
Type=Application
startcontrol.sh:
#!/home/bash
#sudo /bin/bash clock_init.sh
sudo /usr/bin/python2.7 /home/debian/Desktop/SimB.py
Many thanks to Cyril Laury.
My next software tasks were:
paintflow.desktop
[Desktop Entry]
Version=1.0
Exec=sudo /home/debian/Desktop/startcontrol.sh
Name=Paint
Comment=Start up SimB.py
Encoding=UTF-8
Terminal=false
Type=Application
#!/home/bash
#sudo /bin/bash clock_init.sh
sudo /usr/bin/python2.7 /home/debian/Desktop/SimB.py
My next software tasks were:
- record data on a USB flash drive plugged into the BBB,
- add a Real Time Clock (RTC) module to the BBB,
- add software for the RTC,
- add an Idle mode to the paint flow control when the paint gun was turned off.
Then there are the hardware tasks:
- fabricate the Analog I/O boards and get them loaded,
- design the hardware system, purchase power supplies and other parts, and
- get the hardware installed in the Protocase enclosures to complete the hardware tasks.
So I still have much to do and will report on those tasks in future posts.
So, that's all for now and back to work.
John
No comments:
Post a Comment