Close

Power supply issues and M codes

A project log for Fox.Build PNP

This is an attempt to bring pick and place capability to our makerspace based on the work done by Erich Styger

shanesnipeshane.snipe 11/28/2019 at 15:570 Comments

We have been putting the electronics together and overall the build has gone well. Here is a general layout.  The additions to the design that we incorporated were as follows:

1) Added a fan mounted directly to the 24 V power strip to cool the motor drivers.

2) Mounted the pump on some foam to try to reduce noise and vibration.

3) We replaced the power supply with something we had in the shop. The one on the BOM had power spikes when we looked at it with a scope and somehow was not doing the job. The motor drivers seem to shut down when we used it and despite numerous attempts to put the cheap one back in we gave up and ran with this one.

https://www.galco.com/buy/Puls/CS10.241?source=googleshopping&utm_source=adwords&utm_campaign=&gclid=CjwKCAiA_f3uBRAmEiwAzPuaM3qPp0luyInRAviphrkichK8hADd3l58YIG78lWZTVyJ9QzqZJmAqRoCQusQAvD_BwE

I had never looked it up before as it was a donated supply. (Thank you Butch!) This power supply is worth $250. Wow!  I expect any power supply that provides a clean 24V will do.

4) We mounted everything directly to the particle board base. This worked well as it is flat and easy to screw to. Until we screw down the top, it is quite easy to access as well.

Overall we are very pleased with the layout. The smooth board USB connector and MicroUSB card can easily be accessed. We will put the two power cords on a separate power supply because we seem to need to dump the power often in debugging and calibration.

Once we got everything sorted, we tried to get the camera's working. Following the instructions in the PNP guide.   https://github.com/openpnp/openpnp/wiki/Setup-and-Calibration%3A-General-Camera-Setup

Everything worked for the camera in the head but the up facing camera did not work. We did the obligatory swap and found the camera to be non- functional.  I was pulling up Amazon to try to get another and Doug took it over to the solder bench with the big magnifier. Two minutes later after a few touch ups on the high pin count IC legs with a solder iron, we try it again and it works! I suppose the moral of the story is that if something does not work, take a really good look at it.

The last hurdle we came across was that when we hooked everything up, only have half the items worked. The pump and the Head LED  ring were fine. The up looking camera LED ring and valves did not seem to be working. Even more strangely, when we turned on the Valve, the voltage on the pump dropped to 17 V.   Back to Google and we found a requirement to add some jumpers to use the P2.x ports. Here are the locations in pink for the jumpers on the Smoothie board. 

Thank you open builds. Here is the link and the information that saved us is under the Electronics heading. https://github.com/openpnp/openpnp-openbuilds/wiki/Build-Instructions

The last piece of the puzzle that we had to search for was the list of M-Codes. The example had the little comment that said we should use what ever M-code works for your machine.   https://github.com/openpnp/openpnp/wiki/Setup-and-Calibration%3A-Camera-Lighting

After more searching, it turns out it was all in the setup file provided by Dr. Styger.  Here is the relevant portion of the code.

https://github.com/ErichStyger/McuOpenPnP_Machine/blob/master/Smoothieboard/config

# Switch module for head light control
switch.headlight.enable                            true             # Enable this module
switch.headlight.startup_state                     false            # turned off at start
switch.headlight.input_off_command                 M800             # Command that will turn this switch off
switch.headlight.input_on_command                  M801             # Command that will turn this switch on
switch.headlight.output_pin                        1.22             # Pin this module controls: small MOSFET Q4
switch.headlight.output_type                       digital          # Digital means this is just an on or off pin

# Switch module for bottom light control
switch.bottomlight.enable                          true             # Enable this module
switch.bottomlight.startup_state                   false            # turned off at start
switch.bottomlight.input_off_command               M802             # Command that will turn this switch off
switch.bottomlight.input_on_command                M803             # Command that will turn this switch on
switch.bottomlight.output_pin                      2.6              # Pin this module controls: small MOSFET Q9
switch.bottomlight.output_type                     digital          # Digital means this is just an on or off pin

# Switch module for vacuum pump (Q5)
switch.pump.enable                                 true            # Enable this module
switch.pump.startup_state                          false           # turned off at start
switch.pump.input_off_command                      M804            # Command that will turn this switch off
switch.pump.input_on_command                       M805            # Command that will turn this switch on
switch.pump.output_pin                             1.23            # Pin this module controls: big MOSFET Q5
switch.pump.output_type                            digital         # Digital means this is just an on or off pin

# Switch module for vacuum nozzle 1 (left)
switch.vacnoozleleft.enable                        true             # Enable this module
switch.vacnoozleleft.startup_state                 false            # turned off at start
switch.vacnoozleleft.input_off_command             M810             # Command that will turn this switch off
switch.vacnoozleleft.input_on_command              M811             # Command that will turn this switch on
switch.vacnoozleleft.output_pin                    2.5              # Pin this module controls: small MOSFET Q6
switch.vacnoozleleft.output_type                   digital          # Digital means this is just an on or off pin

# Switch module for vacuum nozzle 2 (right)
switch.vacnoozleright.enable                        true            # Enable this module
switch.vacnoozleright.startup_state                 false           # turned off at start
switch.vacnoozleright.input_off_command             M812            # Command that will turn this switch off
switch.vacnoozleright.input_on_command              M813            # Command that will turn this switch on
switch.vacnoozleright.output_pin                    2.7             # Pin this module controls: small MOSFET Q7
switch.vacnoozleright.output_type                   digital         # Digital means this is just an on or off pin

 So the MCodes are:

M800  - Down facing LED off

M801 -  Down facing LED on

M802 - Up facing LED off

M803 - Up facing LED on

M804 - Pump off 

M810 - Valve 1 off

M811  - Vale 1 on

M812 - Valve 2 off

M813 - Valve 2 on

There is a command line in Open Pnp where these commands can be input and it allowed us to drive everything and even start picking up parts before we have even gotten the machine calibrated and all the actuators set up. This was cause for celebration for sure as the end is in sight!

Discussions