Mike's SCARA Robot

I messed with a whole load of stuff that never got released, sadly. Too much to do, too little time. I started the Kerbal Foundries mod, which included wheels, caterpillar tracks and all sorts of whacky stuff, as well as collaborating on lots of other mods. One of the guys I frequently worked with was a robotics specialist - was a really interesting guy. We discussed the Canadarm and messed with a few rigs - he even made a lovely model - but decided it was probably a step too far to create the solver just for a game! Lol.

Either way, really interested to watch your progress on this.
 
Been thinking some more about the control software I am going to write for this robot and wanted to share my thoughts.

I think I am going to build the graphic interface pretty similar to Mach 4. I'll probably aim for a bit more graphics area and dump most of the CNC centric graphics like spindle controls and tool changes.

1600699464258.png

Here are the things my software/graphics must have:
  • Welcome screen with navigation to startup tasks, diagnostics, and runtime screens
  • Ability to load G-code/robot code into the PLC using a flashdrive (I know this is going to be much harder than it should be)
  • Ability to interpret G-code/robot code (write a custom interpreter)
  • Automatic homing
  • Robot kinematics (obviously)
  • Jogging
  • Display of cartesian position and joint angles
  • Lookup table of taught locations for use in robot code
  • Fault handling
  • Ability to read PLC inputs and control outputs from the execution of the G-Code
  • Realtime adjustment of speed, acceleration, etc.
And things that would be really cool to add:
  • Animation of the robot arm showing the workspace bubble and the robot links as viewed from above. Bubble should update when the tool geometry is updated.
  • Singularity avoidance (stop motion before hitting the edge of the workpiece bubble, including during jogging)
  • Collision avoidance (stop motion before hitting objects defined in the workspace). Add these items from the HMI and have them appear in the graphics window.
  • Code test mode - verify code function before moving robot in real life. Verify no collisions or other abnormal conditions
 
I messed with a whole load of stuff that never got released, sadly. Too much to do, too little time. I started the Kerbal Foundries mod, which included wheels, caterpillar tracks and all sorts of whacky stuff, as well as collaborating on lots of other mods. One of the guys I frequently worked with was a robotics specialist - was a really interesting guy. We discussed the Canadarm and messed with a few rigs - he even made a lovely model - but decided it was probably a step too far to create the solver just for a game! Lol.

Either way, really interested to watch your progress on this.

That's so cool - I've seen that mod! That game is a blast and I think it must've been pretty neat to get involved with the modding community. That's completely foreign to me!
 
Spent some time working on the robot last night again. The homing sensors are proving to be a bit trickier than anticipated. Let's discuss.

The first issue is that wiring information is spread out across lots of different documents and some of the information (like the circuitry on the robot PCB itself) is completely undocumented. This isn't unexpected since this interface would have been between the robot and the matching controller. I've attached my horribly drawn circuit diagrams from the PCB inside the robot. I'm almost too embarrassed to share this, but it is helpful info. Again, I drew this as I was reverse engineering the board and it conveys the order in which I went through each trace on the board, and does not necessarily convey electrical function. Below are the other relevant excerpts from the robot manuals.

This is the overview of the cable harnesses. They are nicely labeled inside the robot and can be unplugged at each connection point shown in the diagram.

1600781273851.png

This is the pin assignment detail for the T3/Z axis motor and sensors. There are similar diagrams for the other motors. The connector "X30" is a rectangular connector on the PCB inside the robot. The manuals do not indicate how the PCB interfaces the "X30" connector to the "X1" connector which is the one that the IO cable plugs into from outside the robot. That is why I needed to draw the PCB circuit by hand.

1600781397357.png

Here is a cleaned up sketch of just the Z axis homing sensor circuit. This is what I need to interface to. NF1 is a power filtering component, R3 is a current limiting resistor for the sensor power supply, and HL3 is a green LED which illuminates when the home sensor is triggered. Notice the direction of HL3. Not only is an NPN sinking sensor installed, but the circuit board forces the direction of current to flow into the sensor.

1600788990665.png

The homing sensor is a Sunx/Panasonic GXL-8F miniature inductive proximity sensor 12-24VDC NPN-NO, Sn: 1.8mm. From the data sheet, we can see that the sensor is an NPN transistor type and wants to sink the load current.

Normally you would hook these up to sourcing inputs which would have the inputs pulled up to 24V by an internal resistor. This way, when the NPN type sensor turns on, the input pin is shorted to 0V. When the sensor turns off, the pullup resistor brings the input voltage back to 24V

1600782420110.png

My issue is that the 1756-M02AE servo interface module has sinking inputs for the home sensor and expects a PNP sourcing type sensor to be connected. UGH!

1600784353843.png

From that same manual, the specifications for the input voltage is that it must be higher than 17.0V to be registered as HIGH and less than 8.5V to be registered as LOW.

1600785095580.png

Here is my solution to the issue. I think I can add an external pull-up resistor at the analog interface module terminals. It needs to fight the pulldown resistor enough to get the voltage well above 17.0V and it needs to draw less than 100mA when shorted to ground or the sensor could burn up. It also needs to dissipate low enough power to not damage the resistor

I first tested this idea with a 4700 ohm 1/8W resistor, but only got the voltage up to 15.6V. Making the assumption that the 1756-M02AE servo interface module only has a simple pulldown resistor, then you can do a voltage divider calculation to figure out that the equivalent resistance of the internal resistor to the module is roughly 8750 ohms. EDIT: I noticed that the manual shows an input impedance of 7500 ohms. Close enough :)

I looked in our lab at work and found some resistors in a little tub of scrap electronics that as probably been untouched for 30 years. They are Vishay Dale CPF-2 Precision Metal Film Resistors. They are 2000 ohm +/- 1% and rated for 2W. Let's check the calculations. First the voltage divider calculation indicates I can expect a 19.5V ON voltage (EDIT:18.9V assuming 7500 ohm input impedance) which is sufficiently well above the 17.0V limit. Next, when the proximity sensor turns on, it will draw 12mA of current, which is less than the 100mA limit on the sensor. Finally, that 12mA at 24V will dissipate 0.29W which is less than the 2.0W rating of the resistor. The proximity sensor guarantees a residual voltage of 0.4V at 16mA and we are even lower than that. We should be way below the 8.5V lower limit for OFF voltage.

1600787168405.png

I think this should work! I plan to wire this up tonight to verify. Here is the same sketch from above, but now the terminals for the 1756-M02AE are added and the 2000 ohm pullup resistor are shown. Terminal 6 (ENABLE-0+) on the 1756-M02AE is shown only because it to directly connected to the 24V power supply and is a convenient place to put this resistor, however the enable input plays no role in this circuit.

1600789509732.png

And this is just for the Z axis! The other 3 axes use a different kind of optical gate sensor for homing. I'll need to go through this same exercise for one of them to figure out how to make this work, but I expect it will be very similar.

NOTE: the red marks in the attachment refer to what I damaged a few posts ago. These have since been repaired.
 

Attachments

  • Robot_PCB_Schematic.pdf
    2.5 MB · Views: 5
Last edited:
Project update time!

Z Axis Homing is completed and functional. My addition of the external 2000 ohm 2W resistor worked well and gave me a respectable voltage of 19V when ON and 2V when OFF. Not ideal, but sufficiently above and below the noise margins on that input. I configured the servo module to use a Normally Closed homing sensor. I then added homing to the simple program I wrote before so the Z axis fully retracts before starting movement. I also rewrote the code to use absolute positions instead of incremental distances. Here is a short video of that in operation. (I am having trouble with the video sizing. Something with the HM interface. If you view fullscreen, the resolution and size should be better)

View attachment IMG_9669.MOV

























The axis drives towards the switch at a medium speed. When the sensor is triggered (red LED comes on), the motor stops and reverses off of the switch at 1/8 of the initial speed. When the home sensor turns off, that position is recorded as home and the program begin a cyclic up and down movement.

Amusingly, you can see my cat chilling on my workbench in the background.

T1, T2, T4 Homing is my next major hurdle. I ended up starting a post on All About Circuits to try to get some help on this. Unlike the Z axis, which uses an inductive proximity sensor, the remaining 3 joints use an Omron EE-SV3 "Photomicrosensor (Transmissive)" with a fiberglass "code wheel" to trigger it. I'm pretty sure I have the EE-SV3-B model. Here is the link the the datasheet: https://omronfs.omron.com/en_US/ecb/products/pdf/en-ee_sv3.pdf

Image084.JPG

Here is a schematic of the sensor on U axis.

1601036806004.png

This sensor is configured to work similarly to the proximity sensor in that it pulls the input down to 0V, however it differs in that when it is ON (nothing sitting between the gate), it only sinks 6mA (while the proximity sensor could sink up to 100mA). This means it is unable to pull the input below the 8.5V requirement when the input is pulled up by the 2000 ohm external resistor.

I did the math and it turns out there is no value for the external resistor which satisfies both the input high >17V and input low <8.5V requirement. I'll save the gory details, but what I ended up needing to do is change out a resistor on the robot's internal PCB from 1200 ohm to 800 ohm. This allows more current to pass through the photogate emitter and also allow it to sink more current on the phototransistor. By adding the 2000 ohm external resistor and swapping in an 800 ohm resistor, I *should* be able to get 6V when the input is low and 19V when it is high. This should be acceptable.

I purchased some 800 ohm 3W resistors from Digikey at $2 each. I didn't want to modify the robot at all, but this is a small change to allow me to use the analog servo interface module that I have. These should arrive tonight.

Here is a simplified version of the schematic. I will be installing R1 externally with a value of 2000 ohms. I will be removing R4 from the robot PCB and replacing it with an 800 ohm.

1601043137474.png

DIN Rail Components

Here's a picture of where the DIN rail wiring stands.

Image093.JPG

Starting at the top left, I have a couple of terminal blocks for connecting PE grounds. Then there is a 20A main breaker (shares power to the other two breakers), a 6A breaker for the PLC and DC power, and another 20A breaker just for the drives. There 6A breaker feeds the 24V 3.5A supply and the 5V 2A supply. Each supply passes through a fuse and gets distributed across the terminal blocks on the top.

The bottom row has some spare terminal blocks for the safety wiring, a dual channel input safety relay and an expansion module. Then there are a few terminal blocks and a slim SPDT relay for the Z axis break. Finally there are 68 terminals connected to the robot SIGNAL cable.

I don't love how messy this is, but hopefully I can clean it up if I put this in an enclosure at some point.

I started the T1 & T2 Drive Wiring. I hooked up cable to the remaining two feedback adapter boards. I will go back and clean up the Z axis wiring as well - it is messy since it was the first one I worked on.

Image085.JPG

Looks pretty clean actually!

Image088.JPG

All 4 installed!

Image090.JPG

Terminal Block Pinout


I finally completed the mapping between my terminal block numbering and the SIGNAL number in the manual for the robot. They zig-zagged around the connector while I counted straight across. I think I followed industry standard - and I'm sticking to that story.

1601044680284.png

This will be very helpful to have. Not entirely sure what the signals HCOM, EMB1, and THS do yet.

Hoping to get the homing switches, T1 & T2 motor wiring, and the analog interface to T1 & T2 done soon. I see the light at the end of the tunnel for work, so I hopefully I will have a bit more time soon.

-Mike
 
Last edited:
@macardoso

Mike, I am really enjoying this thread.
Thanks for all the photos and details you provide.

-brino
 
Another weekend of big progress forward! This is getting to be really fun.

I realized I take very few shots of the entire robot. It is pretty large and I often try not to show off my cluttered little basement shop, but it is good to get a sense of scale and layout. There are plastic covers which go over the top of the second arm link and hide the motors and cables.

Image096.JPG

I started out by finishing up the wiring to the T1 and T2 axis drives. All 4 of the new encoder interface PCBs started up without a glitch. So happy with there - probably the most successful part of the project.

Image098.JPG

I tested out each of the motors running only from the servo drives (talking to my laptop with a serial cable). I was able to run hookup tests and autotune the servos without issue. Here are two videos of the first movements of the arm links.

This is the T2 joint motor. It is coupled to a 72:1 harmonic drive gearbox. The arm is flopping around because the T1 axis is powered off and free to move. This was roughly 75% max speed.

View attachment IMG_9702.MOV
















And the very first movements of the T1 axis. The acceleration needed to be limited to roughly 2% of maximum or the table it is sitting on would really start to shake. This robot has some impressive power. The T1 joint motor is located inside the cast aluminum base and is oriented shaft-up connected to a 100:1 harmonic drive gearbox.

View attachment IMG_9703_Trim.mp4
















I then powered up the PLC and commanded motion on the Z and U axes while letting the drives continue to control the T1 and T2 joint motors. This created 4 axis motion similar to how the robot will look once I get a 4 axes running under coordinated PLC control.

View attachment JWNA2645.MOV
















I let this run for several hours while I began wiring the remaining two channels of the 1756-M02AE analog servo interface module. I went out and bought 200' of my favorite multiconductor data cable. They are 24AWG and come in 9, 15, and 25 conductor varieties with a foil shield and drain wire. The whole cable is very thin and is great to work with compared to the thick 16AWG wire I used on the other card. It is L-Com CS15-100.

1601309934827.png

Here is the mostly completed wiring harness before packing up tightly inside the wiring door.

Image101.JPG

I finished the wiring by adding the two drive connectors and cabling for power and home sensor connections. This took almost 3 hours in total to get this harness assembled.

Image102.JPG

I hooked up the harness to the drives and added the motors to the PLC program. 20 minutes of configuration and tuning and now all 4 axes are fully integrated into the PLC!

Image103.JPG

With this done, I am tremendously close to getting it working. The next biggest hurdle is homing. The robot kinematics require a very accurate knowledge of the arm's orientation when the kinematics are started up. Since these motors have incremental encoders, the only way to accurately know the arm's position is to have reliable homing. The home sensors must be very repeatable and trigger at the exact same location every time homing is activated. I also must know the exact angle of the arm when the home sensor is triggered. this is going to be tricky and will be discussed in my next post.
 
So the homing sensors are the next problem child in this project. As a quick recap, the 1756-M02AE servo interface module is responsible for reading the homing sensors and has an internal 7500 ohm resistor pulling the input down to 0V. It expects 24V to be externally applied to drive the input high.

The robot has sensors (called transmissive photo interrupters on Digikey) which are wired to pull an external input down to 0V. This is likely because the original robot controller used the opposite type of input as the module I am trying to use. I thought I could get clever and add external resistors and swap resistors on the robot PCB to get this to work (as shown in the picture below), but this isn't working very well.

Image104.JPG

After adding all the external resistors and swapping out 3 out of 4 resistors on the PCB, here is what I found.

Z axis homing works great still. I will not mess with this. It gives 19.3V high and 1.9V low.

U axis home sensor is functional, however there is some kind of short on the PCB pulling the input down to 2.0V regardless of if the sensor is plugged in or not. I am pretty sure this is somewhere between the diagnostic LED and the sensor shown in this sketch. I will have to investigate further.

1601311619982.png

The T2 home sensor circuit is semi functional (gives 19.3V high and 10.0V low when tested with a good sensor), however the sensor itself is covered in heavy dark oil and is completely non-functional. It is hard to see in the image below, but that is the sensor, viewed from the bottom of the T2 joint. Replacing this sensor is going to be a real pain and will require me to disassemble the T2 joint. The two cylinders inside the arm (just barely visible, translucent amber color) are the hard stops on the T2 axis and are rubber to absorb impact.

Image110.JPG

The T1 sensor and circuit are fully functional (19.3V high and 8V low), but the code wheel used to trigger the sensor has multiple slits in it. This means the sensor could indicate home in one of many positions. I bet this is designed this way since the user can install bolts which act to limit rotational travel of the J1 axis. If there was only one slit and the travel was limited, it is possible that you wouldn't be able to home the robot. I'd prefer to change this up so there is only 1 slit and then I do not need to manually position the robot before executing the homing sequence. This will require disassembling the T1 joint as well. I expect to find a similar multi-slit code wheel in the T2 joint when I open it up, but right now, I cannot tell.

I think the right thing to do here is replace the sensors with ones that are appropriate for my type of input. Option 1 is to rewire the existing sensor to source current instead of sinking. I'd still have to replace the T2 sensor but I could use the identical part. Option 2 will be to replace the sensors. The ones I have are "transmissive photo interrupters - phototransistor output" (general term according to Digikey). They also have these sensors with logic outputs which are a digital signal that is amplified. This is closer to what I want if I could find one that had the same physical dimensions (or close enough) to the ones I currently have. I am actively looking for a replacement, but it is hard! There are a billion shapes and sizes of these. Panasonic and Omron seem to have the largest selection. I placed a support request into Omron to see if they could help me with sensor selection.

I really want to find a sensor that bolts into the existing mounting holes otherwise I have to machine new brackets. New sensors are $10-$40 each.

The other challenge is I need to get a replacement connector for the other end of the sensor. I spent 2 hours looking for this connector last night and finally identified it as a Molex series 5102 SPOX connector P/N: 5102-3. This has been discontinued for some time and the only replacements available are from Alibaba. The recommended replacement is P/N 51191-0300, but I am not sure if it will mate to the receptacle for the original connector. They are pretty cheap, so I might just buy the parts and try it out. I also do not know if the crimpers that I own will work on these connectors.

Image107.JPG

If I do manage to get these sensors working, the final challenge will be accurately measuring the angular position of the home sensor relative to the absolute angles of the arm. This is critical to getting the kinematic transforms to be accurate. Here is my plan. I need to measure the centerline of the base of the robot and project it out across the table. I can then place a dial indicator on the table and run it against the circular casting of the T2 joint. I will sweep the arm back and forth until I find the high spot in the indicator travel. I will then measure how many encoder counts occur between this spot and the home sensor location. I can convert this to degrees.

Once I have determined the T1 home sensor angle, I can lock the T1 axis at 0 degrees and repeat the process further away for the T2 axis, measuring against the collar on the end effector (ballscrew). I should be able to get very accurate measurements with this technique.

Once I have these numbers, I can finish filling out the kinematic transform settings and start using this as a true robot!
 
Very cool project, way over my head. But I love to read about it and see the logic you use in analyzing and diagnosing the issues and solutions.

Very impressive.
 
Can you not just buffer those limit switches with an appropriately chosen and arranged transistor circuit? Should be way simpler than replacing the ones that are hard to get to?
 
Back
Top