Monday, 22 July 2013

Calling down the oscilloscope

Having seen no reaction from the extruder motor, I decided to use the oscilloscope in FabLab to see if the correct signals were being sent. This turned out to be a more difficult task than expected, mainly because I don't have the first clue about oscilloscopes. I and a few other FabLab members fiddled for a while with the knobs and dials without seeing any output. The calibration output showed a nice signal, but nothing from the Arduino.

It wasn't until a 70-year-old electrical engineer offered his advice that we figured out what was going on: The signal was so weak that it didn't trigger at the voltage we expected. Even though the signal is supposed to be 5V, a capacitor somewhere in the circuit cut it down so quickly that we needed to go down into 1/100ths of a volt to see the signal. Must be something in the Arduino.

With this new knowledge, I ran raw GCode commands against the Teacup firmware. Trying the various extruder-specific commands didn't do anything, but just using G1 Enn to tell the extruder to move gave the expected signal. So it does work, if you just ask it the right way. I wonder if ReplicatorG doesn't do that. Looking at the generated GCode, it does indeed use the G1 commands, maybe it's just the manual control panel that doesn't.

Tuesday, 16 July 2013


Finding out what's up with the temperature does not require the full Monster. I took the Arduino home, and am using a simple potentiometer to emulate a thermistor.

Adding a printf (sersendf_P(PSTR("RAW TEMP[%d]:"), temp), to be exact) and it shows that the raw read is correct. The temperature table however always gives 0. I'm thinking something is read out of bounds.

Problem solved: The temptable is actually a list of lists of pairs of temperatures, but I only defined the list of pairs. Adding an extra pair of brackets helped immensely.

Oh, joy, new version of Arduino wants to change my filename extensions. Including those in the teacup firmware. I don't think so...

Moving on to why the extruder doesn't work... testing the voltage of the Z axis dir pin shows it changes between 0 and 5 depending on direction, while the step pin goes up a bit when told to move, regardless of direction. The step pin only goes up slightly because it's sending timed pulses. On the extruder pins (using the ReplicatorG control panel) - nothing.

Trying to figure out which GCode to use to run the extruder. M108 and M113 both give Bad M-Code. System info (M115) says there's an extruder. Turning the extruder forward/reverse (M101/M102) shows nothing on either pin. G0/G1 commands give no reaction either.

Some fiddling with G1 and M114 shows that repositioning indeed takes place. The default feedrate was 50, slow enough that it was hard to measure. At a feed rate of 1000, it's clear that there's stepping going on.

The E position is odd, but that's probably just me not understanding how a circular position is represented. It's definitely doing something, but only in one direction.

I'm not entirely convinced that Teacup thinks of the extruder as a stepper motor rather than a PWM. Must investigate later.

Monday, 8 July 2013

Fiddling with GCode

Repeatably, I see the temp sensor and extruder motor working with hand-crafted Arduino code but not with Teacup firmware through the ReplicatorG manual control panel. To fix this, I took the GCode in the ReplicatorG model I'd created long ago and trimmed it down to just heating and reporting temperature. When I tried to run it, I got a number of safety check warnings. First: Recreate GCode with the new firmware - the GCode was created for other firmware setup. Didn't change much. Found out how to cut ReplicatorG out of the equation: By running the firmware in the Arduino app, opening the serial monitor, setting baud to 115200 and line ending to newline, I can run commands directly to the GCode interpreter. And, indeed, it just returns 0.0 for temperature. Maybe there's a problem with the thermistor table.