Tuesday, 10 November 2015

Robot Arm - Full Control

Last time on the Robot Arm project, I was able to control two of the motors on the arm from a Raspberry Pi using a single Arduino and motor shield.

The arm however has 5 motors so this does limit what I can do with it. I decided to get a new Arduino and Motor shield and add them to the project.

The new motor shield is a cheap build of the old Adafruit motor shield. This requires different code to control from the previous post. A more detailed description can be found here.

The new Arduino is a standard Uno board.

I got lucky here, because when I plugged it into the USB hub it is recognised at /dev/ttyACM0, the old board was recognised at /dev/ttyUSB0. (It also appears as Arduino Uno, instead of Arduino Diecimila or Duemilanove w/ ATmega168 in the Arduino IDE.)

This allowed me to use both easily with the following design:
No matter how I plug the Arduinos into the hub, or which order, I can still reliably address each one independently.

The python script needed two lines changing to allow me to send the same character to both Arduinos. They each ignore characters intended for the other one.

import termios, fcntl, sys, os, serial

arduino1 = serial.Serial('/dev/ttyUSB0')
arduino2 = serial.Serial('/dev/ttyACM0')
fd = sys.stdin.fileno()

oldterm = termios.tcgetattr(fd)
newattr = termios.tcgetattr(fd)
newattr[3] = newattr[3] & ~termios.ICANON & ~termios.ECHO
termios.tcsetattr(fd, termios.TCSANOW, newattr)

oldflags = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, oldflags | os.O_NONBLOCK)

try:
    while 1: # This is a tight loop with high CPU
        try:
            c = sys.stdin.read(1)
            # repr() : Return a string containing a printable
            #    representation of an object
            arduino1.write(c)
            arduino2.write(c)
            print "Read character from stdin", repr(c)
        except IOError: pass
finally:
    termios.tcsetattr(fd, termios.TCSAFLUSH, oldterm)
    fcntl.fcntl(fd, fcntl.F_SETFL, oldflags)





The full code can be found on GitHub: https://github.com/jscott7/Robot-Arm.git



Monday, 9 November 2015

ZEUS Safety Shift - Part 2

Previously I introduced the ZEUS safety shift, a duty performed mainly by the Ph.D. students who worked with the Particle Physics detector. Now to go on the walk round!

The first step I took was to return back up to the ground floor to check the gas mixing rack (the panel just to left of centre). Here you would check the pressures on various manometers. A process for dealing with any deviations from norms was provided.


Turn 180 degrees and look back. Here you can see the pipes heading off on their way to the Pit. The corridor here leads back to the main entrance doorway (seen from the outside in the earlier post).


Now I would take the lift down floors to the 6th floor, actually 2 floors underground. Go through some doors in front of me out of the lift and I ended up in a large machinery space.

The yellow line on the floor is a fluorescent paint that guides you to the exit in case of a power cut. Turning off the lights resulted in the room being bathed in a eerie glow from this and various indicator lights. This could easily be a set for a sci-fi movie!

Following the line to the silver door in on the far wall, I would turn the corner and see my next target in the gloomy distance.

These were the calorimeter power supply units. The safety check here was to ensure the temperatures remained within safe bounds.


The large air conditioning ducts to the left in the earlier picture also had a habit of making a noise that sounded just like something scuttling through them, just to add to the atmosphere.

As an aside, the 6th floor also had the electronics lab where I spent quite a few hours analysing components of the tracking detector trigger using the test bench seen below.


My next task was to re-enter the Pit and check the far side of the detector, this involved passing under the beam through this concrete lined tunnel

The back of the detector was certainly more cramped than the other side.

The primary check here was to check gas flow through a bubble gauge, the yellow cabinet just to left of centre
I would then make a walk around the front of the detector to perform general checks before the final destination on the round which was inside the Rucksack. Here we would check on the trigger components.
An interesting, and fortunately rare, issue here was that the electronic cards would gradually ease themselves out of their sockets over a period of time due to vibration from the cooling fans. On one of my last shifts, I was on duty with a senior member of the collaboration who hadn't been shift leader for some time. Early on in the night he noticed a problem with the data from the detector that was serious enough to consider turning of data collection entirely. He asked me if I'd seen it before and while I hadn't seen those particular symptoms I said I'd head off to the Rucksack to check it out.

When I got there, I simply gave every card a push. I returned to find all was well with the data. (I remember giving a suitable vague and complex explanation)

And that was it, back to the control room for another couple of hours working on analyses until your next walk round.

I think this sign nicely summed up the end of 8 hours underground. Warning, Danger of Health!