−Table of Contents
K100 Arduino and accessories
In service of developing a movable calibration source (first tested in Run 71), Nick has developed some hardware, firmware, and software which is generally based around an Arduino microcontroller. This page is to document some of these pieces.
Arduino
We use an Arduino Uno board to control a stepper motor and other simple devices. It can be programmed via usb-serial connection (see website for extensive details and how-to's). Attached to this is an EthernetShield V1 which allows communication via telnet. Nick has written some firmware to handle ethernet communication and simplify motor control. The firmware can modified by using the Aduino Web Editor. Version (v2.0) of the code is copied here.
In 2020 the firmware was modified for more functionality. After changes in the network we couldn't figure out how to communicate with the Arduino over telnet, so we switched to a direct connection from the fridge computer which allowed direct communication through the Arduino Web Editor. But this does not allow us to run Python scripts to send commands. So Nick wrote new functions in the firmware, specifically a “move and wait” sequencer allowing us to move a few steps, wait for it to cool down, then repeat for a certain number of moves.
Nick's firmware code can be found here: https://create.arduino.cc/editor/flyingfeet213/083dfa23-4f45-4eaa-87c7-e62b2ff1883e/preview
The output of the help command from that software gives a good overview of its functionality:
********** serial_stepper Version 3.2 ********** Commands: help - displays this message quit - quit telnet connection mvto [step] - Absolute move. mv [+|-][numSteps] - Relative move. mvNwait [+,-][#steps] [waitSec] [Nrepeat] - Repeated move and wait command. rd currstep - Read current step. wr currstep [step] - Write current step. rd dwell - Read step signal dwell in ms. wr dwell [delay]- Write step signal dwell in ms. **********
Connecting via Arduino Web Editor
Starting in 2020 this is the only known way to communicate with the Arduino.
Connect the Arduino to a USB port on the fridge computer (running Windows), spa-vuk1. In a browser on that computer go to https://create.arduino.cc/editor/. You will need to create an account to use the Arduino Web Editor. To establish connection you first need to run Arduino_Create_Bridge. There should be a shortcut on the desktop - just double-click it. Click Monitor on the sidebar. This should open up a communication portal - commands can be entered and sent with the Send button, and output is printed below. “Help” will give a menu of command options. As of this writing the standard dwell setting (one that seems to work with the cold stepper motor) is 40 ms, which can be set with “wr dwell 40”. (By default the firmware sets this to 15 ms.) Move commands can be issued here, including “mvNwait” which can move the source a few steps, then wait for it to cool, then repeat. In Runs 71 and 73 we moved 4 steps at a time and waited 4 minutes. For example, for 400 steps total in the negative direction, the command is “mvNwait -4 240 100”.
Connecting via telnet
Starting in 2020 this method no longer works. See Arduino Web Editor above.
To connect to this Arduino and ethernet shield via telnet, plug an ethernet cable into the shield and power the Arduino with USB. A bunch of lights should start blinking on both boards. Open a terminal on any PAN computer and run the command
telnet cdms-arduino1
As with DCRCs, computing has helped us set up a static IP and alias for this board: cdms-arduino1 = 192.168.96.13. The board should connect and present you with a place to enter commands. To initialize the connection, send the command marco until the board responds with polo. Then you can use any of the commands explained by the help command.
Update: Jan 2020, new IP addresses issued, should use the following: cdms-arduino1, IP: 128.101.21.167, Subnet Mask 255.255.255.240, Default Router 128.101.21.174
Running commands
Most of the commands related to the stepper motor are self-explanatory. While powered, the board keeps track of the current step position, currstep. This can be queried or reset. The dwell setting changes how long the board waits between taking steps. Taking too short of a step can cause the motor to miss a step, but the coils remain energized between steps, so longer steps can dump more power. The Arduino has several digital I/O pins that can be used to control other devices. These should only be used by someone who fully understands the current firmware code in the Arduino board because some pins are used for communication between the various boards. As of stepper_ethernet_server_v2, only pins 2, 3, 8, 9 are available.
Stepper Motor
Early development of this device can be found in this Google doc. Basic specs: PF25 48P4 stepper from Nippon Pulse, 12 V, 13 mN•m holding torque, 48 Steps/rev. This thing has 2 coils, so, 4-wires total. The stepping details are handled by a specialized motor driver board: EasyDriver v4.5. This board connects to the motor, a motor power supply, and something to send it stepping signals, like an Arduino.
Electrical check switcher
This is a simple circuit to allow switching between connecting pairs of a set of 3 input connectors to a two-connection output. This can be used to automate measurements of the resistances on a variable potentiometer such as the one used to monitor source position in Run 71.
schematic_k100_relay_bank.pdf
This device can be connected to unused digital I/O pins on an Arduino and controlled in that manner.