Notes on Electronics Project
Table of Contents
1 PREPENDIX: Useful links
- Jake's page on how to make a machine (2018 version) https://gitlab.cba.mit.edu/jakeread/machineweek-2018 or generic version
- How to wire things together https://gitlab.cba.mit.edu/jakeread/automatakit
- Various components and their software:
- Chatter software
- Circuit chatter: https://gitlab.cba.mit.edu/jakeread/atkbldcdriver/tree/master/circuit
- Firmware chatter: https://gitlab.cba.mit.edu/jakeread/atkbldcdriver/tree/master/embedded
- Networking software (installing node.js) https://gitlab.cba.mit.edu/jakeread/rndmc
- Installing firmware on the ATXMEGAS
2 PREPENDIX: Terms of art
- ESC: Electronic speed control
3 We have one faulty board and are scared by a spark
- We have boards which connect to the various motors.
- We solder an ethernet jack and the four wires of the stepper motor to a board. As shown in the video, the four wires of the motor are internally connected to two pairs of pins. You use the multimeter to determine which pairs of wires are connected to each other. Then, you solder them to the board so that connected wires are adjacent to each other: A,A;B,B.
- "Stepper 23" board. Stepper 23 is the type of motor. 23 indicates the size of motor. The board is named after the motor it connects to.
- We have a power supply but do not know how to use it safely. It has screw attachments for AC high, neutral, and low (presumably from the wall), and for DC high out and DC low out. It seems dubious to simply thread wires through screws at wall voltages, so we don't.
- Instead, we retrieve a different power supply that has actual aligator clips. We turn on the machine. We connect V+ to + and gnd to -. The connection sparks, and we turn off the machine. (What we ought to have done was connect the supply first, then turn on the power.)
- We try with a different board (because we didn't initially realize that the spark was a nonfatal problem). Turning on the power supply at 24V creates a jet of grey smoke from a component on the board (which we later determine is the voltage regulator). We turn off the power supply.
- We attempt ramping up from 12V to 24V to see how that fares. At around 20V, it creates additional smoke. We turn off the power supply.
- We test the magnitude and polarity of the voltage being supplied. It is correct.
- We test connectivity of the board itself. The smoky ATK stepper board is 20Ω — oops! at 20V, this is basically a short circuit. In contrast, the other stepper board is 5 MΩ. It is unclear whether the board was damaged to begin with
- We look at the datasheet for the buck converter. We use a magnifying glass to read the identifier of the component we fried. It is 3001208097.
- We begin to suspect that the spark was a mostly-harmless consequence of the way we turned on the power before attaching leads, rather than attaching before turning on the power. We plug in the board and send power. The light turns on. We prepare to try programming.
- (Our current standing is that we have one fried chip which we will try to replace later, and one apparently-functioning chip that temporarily scared us away by sparking. We have a power supply with screw terminals that we do not know how to use, and another power supply with alligator clips.)
4 Chapter two
- Atmel ICE is a programmer. It can talk PDI. Check application notes ("datasheet" for device).
- We download the Atmel programming environment per the instructions on the website, although we resolve to run the workflow through non-proprietary avrdude, time permitting.
- We replace the default (nearly empty)
main.c
file with themain.c
file supplied by Jake on the website. The circuit doesn't work. - Within the ATMEL programming environment, we have to manually rebuild the project so that
- XMEGAs don't choose clock sources via fuses. You can change clock source in your startup software.
- Interlude: we learn how to use the screw-terminal power
supply. Limiting the strain by taping the wire to the board. Fuse
in series with the live wire:
===[+]------[fuse]------[+]=== ===[-]------------------[-]===
- TA confirms that most multimeters are safely rated for testing 24V supplies. (Incidentally, For testing wall voltages, one uses a non-contact measurer. It senses field at a distance. For this reason, it only works on AC — DC produces a magnetic field but the field doesn't change so it can't induce current in a neighboring probe wire.)
Atmel development environment has its own standard library which may or may not have a different API. PDI header is proprietary.
Connecting to AVR and SAM target devices.
The proprietaryness is a property of the programmer; avrdude can probably talk PDI to boards.
The way the network works is you plug the router into the computer. It has a ton of ethernet ports on it, and each one connects to a board that controls a motor, whether it's the stepper board or the spindle board (which controls the spinning bit). Stepper 23 boards are made to size to fit the stepper 23 motors. There are sort of free-form modular boards for the spindle motor. So the spindle controller has to be set up in hardware.
- Router (1), Bread (2), Stepper (4, but one was destroyed)
[ ]
Solder ethernet ports to boards.[X]
Put firmware for the atk router onto the board.[ ]
Assemble the breadboard according to the instructions on the website.[ ]
Get the router board to talk to the stepper and the breadboard. There is a mods-like server.[ ]
Get any firmware onto the breadboard[ ]
Program breadboard to talk to spindle motor. (Plug-looking model aeroplane motor.)[ ]
Program it.
4.1 Adventures in avrdude
- According to the
avrdude
manpage: Atmel-ICE (ARM/AVR) is supported in all modes (JTAG, PDI for Xmega, debugWIRE, ISP). avrdude -p ?
produces a list of possible parts.- Reading the motor chip's part, I see that it is an ATMEL XMEGA 256
A3U, corresponding to the part entry
x256a3u = ATxmega256A3U
- Same process with the
-c
flag for determining the controller. Filtering for the ICE options yields:atmelice = Atmel-ICE (ARM/AVR) in JTAG mode atmelice_dw = Atmel-ICE (ARM/AVR) in debugWIRE mode atmelice_isp = Atmel-ICE (ARM/AVR) in ISP mode atmelice_pdi = Atmel-ICE (ARM/AVR) in PDI mode jtag1 = Atmel JTAG ICE (mkI) jtag1slow = Atmel JTAG ICE (mkI) jtag2 = Atmel JTAG ICE mkII jtag2avr32 = Atmel JTAG ICE mkII im AVR32 mode jtag2dw = Atmel JTAG ICE mkII in debugWire mode jtag2fast = Atmel JTAG ICE mkII jtag2isp = Atmel JTAG ICE mkII in ISP mode jtag2pdi = Atmel JTAG ICE mkII PDI mode jtag2slow = Atmel JTAG ICE mkII jtag3 = Atmel AVR JTAGICE3 in JTAG mode jtag3dw = Atmel AVR JTAGICE3 in debugWIRE mode jtag3isp = Atmel AVR JTAGICE3 in ISP mode jtag3pdi = Atmel AVR JTAGICE3 in PDI mode jtagmkI = Atmel JTAG ICE (mkI) jtagmkII = Atmel JTAG ICE mkII jtagmkII_avr32 = Atmel JTAG ICE mkII im AVR32 mode
Maybe
atmelice_pdi = Atmel-ICE (ARM/AVR) in PDI mode
is the right option?
sudo avrdude -px256a3u -c atmelice_pdi avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e9842 (probably x256a3u) avrdude done. Thank you.
4.2 Getting dataflow machine controller working
Reference: https://gitlab.cba.mit.edu/jakeread/rndmc
- Install node.js and npm (package manager).
- Clone the repo at https://gitlab.cba.mit.edu/jakeread/rndmc
- CD into the directory and run
npm install
to install from the repository's json file. (Thisworks!fails, so install manually usingnpm install
[…] ) - Confirm installation of cp210x usb to uart bridge vcp drivers. When
I run
modinfo cp210x
on my linux machine, the kernel module appears to be installed. - Run
node main
to start the server. - Navigate web browser to
localhost:8080
.
5 Sending signals over ethernet
- We prepare a few more ethernet cables.
- We install node js and the necessary node modules for Jake's
rndmc
. - We are unsure what to connect to what so as to send messages to the motor via the network controller.
- We discover a microusb port on the network board. It is a usb-to-uart converter, according to Jake's page. We decide that the computer sends software commands to the board from usb on the computer to microusb on the board.
- We can't plug in the microusb cable because there isn't enough space—the plastic head runs into the side of the board. Fortunately, that part of the board is actually removable! It's a thin piece of plastic attached via a pre-perforated shear line. We pry it off with pliers, being careful not to damage or bend the rest of the chip. Then it plugs in.
- The nodejs server fails to connect due to permissions error. As a stopgap, it connects to usb when run as root.
- Nothing happens when we attempt to test each node in the sample network.
- We send a bug report:
We are stuck on attempting to send signals from the computer to the network board to a servo board.
- Network board is powered by usb and shows up properly as Bus 001 Device 009: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
- RNDMC is running on nodejs, and is able to find and open the port ttyUSB0.
- However, nothing seems to happen when we attempt to test the network, either when using the built in network program template, or by wiring up our own network with a single servo motor.
- We are unsure how to send the test signal 127 through this interface, so we resorted to using pyserial. We attempted to send a single byte
[127]
and listen for a response, but didn't get any. The only parameters of the Serial object I set was the baud rate (250000), which I found in the atkseriallink.js file.- We are unsure about which LED is supposed to be toggled anyways in response; we assume it's the error LED on the network board.
- We begin making our own Makefile, copying one of Neils.
- We want to change the
MCU
variable to work with XMEGAs. https://www.nongnu.org/avr-libc/user-manual/using_tools.html. We find the lineavrxmega6 atxmega256a3u __AVR_ATxmega256A3U__
which suggests that the correct macro isavrxmega6
.
6 Turning the breadboard into a spindle motor driver.
Relevant literature: https://gitlab.cba.mit.edu/jakeread/simplespindle
7 Experiments with the working network
Here's an empirical experiment to determine which of our new motors is functioning, attempting to limit external factors.
In preparation: Connect the network board to the computer via microusb. Prepare to run rundmc in a terminal. Ensure that power supply will supply more than 12V and less than 24V. Check all cables for connectivity.
- Turn off the power supply, if on.
- Quit the rundmc server, if running.
- Wire motor to power supply.
- Connect motor to network board.
- Turn on power supply.
- Turn on the rundmc server.
- Refresh the browser page.
- Create the atkstepper module.
- Click "Find and connect" to find the tty port.
- Set the address for the stepper module (0,n)
- Send a test network command.
- If successful, send a test motor command.
- Go to step #1.
Motor id | Network address | Test network | Test motor |
---|---|---|---|
A | (0,1) | success | success |
B | (0,1) | success | success |
C | (0,1) | success | success |
D | (0,1) | success | flashing yellow, but no motor motion. no resting motor stiffness (no power?) |
E | (0,1) | success | success |
spindle | (0,0) | success | [TBD] |
To test the spindle motor, we attached a ribbon cable to a six-pin header and plugged it in. We used a multimeter (not the best tool for the job but most convenient) to measure the average voltage being send via pulse-width modulation to the spindle motor pins on the breadboard. The middle pin is high; one of the other pins is low; and the third is the signal from the microcontroller. We wanted to measure the difference between the microcontroller signal and ground.
Network setup
We have four stepper motors (A, B, C, E) and one spindle motor (spindle).
Six things need power: the four stepper motors, the spindle motor, and the spindle motor's electronic speed control (ESC).
[Y axis] A --- B (0,0) (0,1) [X axis] C (0,2) [Z axis] E --- spindle --- ESC (0,3) (0,4)