Emergency Stop ButtonI’m continuing to work on the 3rd installment of the EMC2 and Servo tutorial, but I realized that I hadn’t seen any great treatments out there for simple e-stop implementations with EMC2 or otherwise in the hobby CNC realms. This is the solution I’ll be using as part of the tutorial apparatus.

Safety systems aren’t sexy and so from what I’ve seen in the community those who know what they’re doing quietly implement them on their own systems but then the rest of the hobbyists and newbies may not even be aware of the need for such things and in the rush to get a machine running and doing the sexy stuff leave themselves open to more risk than is strictly necessary.

continue reading…

20120126-151857.jpgSo I’ve been looking into this Zigbee technology that I’d seen around on various sites. I didn’t really know what it was for but it seemed to be some kind of wireless communication technology for use with microcontrollers and such.

Wow did I ever underestimate that!!! I have another project that I’m contemplating and Zigbee could be an ideal solution for it!

Here are a few links I found.

http://www.controlanything.com/Relay/Device/A0004

Circuit Celler – Zigbee Basics

Wikipedia’s Zigbee Article (for good measure).

 

20120119-000551.jpgHey all! Well it’s been a busy past few months for me due to staffing changes at work, Bahamas vacation, holidays, etc.  I just wanted to let you all know that I’m gearing up to get on with things here. I’ve had some really nice feedback from a number of you on the Servo Tutorial so that’ll be first on the list to get finished, then on to what I hope to be bigger and even better things.
Thanks to everyone who’ve been patiently waiting.

 

Stripped Inkjet Printer

Printer Carcass Ready For Use

Continued from Part 1

So you’d like to play with servo motor control would you? Well hopefully you’ve come to the right place and we’ll actually be able to learn you a thing or two. In this next segment we’re going to learn about some of the internals of an old inkjet printer and how to recycle it to serve our purposes.

The focus of this series is around setting up a small servo control lab or test bench so you can play with a DC servo motor on a relatively safe and inexpensive mechanism before you move on to more risky setups. That isn’t to say that the mechanisms you work with here won’t be useful in other ways. On the contrary! Depending on what it is you want to do, these consumer-grade electromechanical marvels may be just the ticket for some light weight applications.

So far I’ve torn apart several inkjet printers and they’ve all shared the same type of print-head mechanism based on a small brushed DC motor and linear encoder, so just about any should do the trick. For your reference, the following are the models that I can definitely say have the bits we need, although some of the mechanical and electronic details may vary from model to model.

Epson Stylus C86
HP Deskjet F335 All-in-One
Lexmark X2470
Dell 810
HP psc 1350 All-in-One

Here I’ll be detailing what I did with the Epson Stylus C86, but the principals should apply to just about every other model out there.

Our Goals – Where are we going today?

Basically our goals are three-fold:

Motor, Gears and Rotary Encoder Wheel

Motor, Gears and Rotary Encoder Wheel

1) Salvage a servo mechanism including brushed DC motor, power transmission (in the form of a toothed belt and it’s support hardware), the print head or “load”, linear guides for the print head travel and encoder device.
2) Remove as much of the extras in the printer as possible while still leaving the above items intact. You may or may not be removing things like the logic board, power supply pinch rollers, print cartridges, other ribbon cables and sensors.
3) Trace some signals so we can determine how to get what we need out of the remaining electronics.

I’ll be focusing on the linear servo-mechanism that moves the print head from side-to-side. Virtually all inkjet printers use this type of mechanism to move the print head from side to side, however you may find some printers have a servo-driven paper feed mechanism with a rotary encoder as well. This is even more straight-forward to integrate as you don’t have to worry about damaging the mechanism since there’s no end-stop to jam against. Most of the things I discuss here will apply to rotary mechanisms also, so you might want to start with a rotary servo as it’s more forgiving than the linear print-head mechanism.

Voiding the Warranty – What’s under the hood?

So the first step is to get into the beast. With the Epson C86 this was surprisingly quick and easy with a minimum of tools as all the panels are snapped in place with retaining tabs. Use a flat-blade screwdriver where needed to pop the tabs and remove panels. Other printers run the spectrum from standard #2 Phillips screws to the slightly more esoteric T-10 Torx and I’m sure there’s someone who’s putting these together with security screws of one or two flavours.

Do what you need to to carefully disassemble the printer. Another thing I liked about the C86 is that when you take the cosmetic panels off and have exposed the mechanism, all the working pieces are still in place. With some of the others parts of the case are integral to the mechanism or its support, so you may have to do varying degrees of disassembly, hacking and reassembly to reach the goals above.

There are all kinds of goodies in these things, so be sure to hold on to some of the bits for later experimentation and hacks. Here’s a sampling of some of the bits I’ve held on to from three printers. You’ll see lots of springs, rollers (hard and soft), optical flag sensors, belt tensioners, stepper and DC motors, connectors, buttons, LEDs, etc.

P1010010.JPG

Bits and Pieces

small_servo1.jpg

Small Servo Motor

Stepper Motor Driven Toothed Belt and Pulleys

Stepper Motor Driven Toothed Belt and Pulleys

Buttons and LEDs

Buttons and LEDs

Stripping the mechanism – Down to the essentials

In the case of the Epson C86, I stripped the printer of its exterior panels leaving just about everything else in place. I removed the head-cleaning station as it would get in the way of the print head as I wanted to control it, disconnected the DC and stepper motors from the logic board and manually moved the paper-feed mechanism so a head stop was retracted allowing the print head to move freely. I left the power supply in place so it could power up the encoder, but that’s just supreme laziness on my part as I didn’t feel like coming up with another 3.3VDC supply to power the encoder reader.

Below are some pictures of the head-cleaner being removed.

If you’re planning to try to reuse the logic board and/or power supply for control or power functions then you need to determine if they will still do what you want without the printer behaving as expected.

For example: Most printers when they’re powered up will do some kind of pre-determined actions to calibrate and clean the print head. This involves moving the print head from side to side at different speeds and distances along its track. If the logic board commands the motor to move and doesn’t see it move it’s possible that it may just shut itself down with an error code and disable power to some of the sub-assemblies inside. In the case of the C86 I turn on the printer’s power supply and after about 10 seconds during which it’s trying to move the disconnected motor it then flashes two red LEDs in protest. Fortunately that’s the extent of it and I’m able to do everything I want with the mechanism with two red LEDs happily blinking away.

Signal tracing – What does what? How do I use it?

Ok so now that the butchery is done, let’s have a look at the pieces we’re going to be interfacing to. Namely, the DC motor and the encoder reader.

The DC motor should be pretty obvious as it’s located near one end of the print head’s travel. It will have the belt that drives the print head wrapped around the motor’s pulley. Being a DC motor it also has two wires coming off of it most likely from the rear. These may be colour coded but not necessarily. If they’re not, then you’ll have to mark the wires in some way that allows you to tell one from the other. For now you don’t have to worry about which is positive and negative as that will be a function of the direction we want the motor to turn, and that will change constantly. The main thing is to be able to tell the two wires apart. Trace the wires to the logic board where they should be attached with a connector. You should be able to remove this connector from the logic board without too much difficulty. You may need to cut the connector from the end of the wires to allow you to connect the motor to the H-bridge motor driver when the time comes.

One thing I did while everything was still connected was hook up a multi-meter to the terminals on the back of the motor and measure the peak voltage that was sent to the motor while the printer was doing its power-up cycle. Depending on your multi-meter this may be tricky without a min/max function, but I believe the Epson measured close to 35VDC during the high-speed moves. This isn’t critical, but good to give you an idea of what the designers intended. You probably can get away with 24, 18 or even 12VDC just fine with proportionally slower speeds.

That’s about all you need to know about the motor at this point, so on with the encoder reader. This can be slightly tricky, but armed with a little knowledge you should be able to work it out without too much trouble.

I won’t go into the fundamentals and principals of encoders here as that’s well covered elsewhere and right now I’m too lazy to include all that. Suffice it to say that we’re looking to work with a linear (or rotary) quadrature encoder and there are a few basic things we’re trying to determine about it.

1) How do I supply power to the encoder reader?
2) At what voltage?
3) How do I get signals out of the encoder reader?

Encoder Circuit Board

Encoder Circuit Board

In order to do this it’s best to remove the encoder reader from the print head so you can get full access to it. On the Epson C86, the encoder reader is on the back of the print head and so the head must be removed from its guide rails. Be careful not to damage the clear plastic encoders strip that runs through the reader. I remove the encoder from the printer first just to be safe.

Once that’s done, carefully examine the small circuit board and locate the reader itself. It’s usually black and U shaped. The circuit board will probably have a few support components on it which may help us figure out how to use it. You can see in my pictures, the reader is connected back to the printer logic board by a white flat cable. I’m going to use this as-is to pass the signals back, I simply want to determine which conductors on that cable are the ones I’m interested in.

An encoder sensor is really very simple. It has an LED on one side (probably infrared) and two photo-transistors on the other side. The LED shines its light through the encoder strip which has fine lines etched on it. The photo-transistors are arranged ½ the line width apart so that as the encoder strip/wheel and sensor move relative to each other. The sensor outputs not only give an indication of the movement but also the direction of movement.

The schematic below shows the basic components inside the encoder reader, and how it connects to the outside world.

Encoder Schematic

Encoder Schematic

 

You’ll want to get at the underside of the circuit board to access the leads of the sensor directly. The first thing I look for is to identify the LED side of the device. This should be easy as the LED side of the sensor will have two pins while the photo-transistor side will have 3 or 4 pins.

Following the traces from the LED you should be able to work your way back to the connector either visually or using a DVM to test continuity. You’ll probably find that there’s a resistor in the circuit as well, so note that in your schematic diagram (you’re taking notes as you go right?) You should now be able to identify two pins on the connector going back to the logic board. Now you can turn the printer on, and measure the voltage at the connector noting the polarity to determine which pin is Vcc (~3.3V – 5V) and which is GND. On the C86, I measured 3.2V. I could have built a custom power supply to drive that, but the printer’s own power supply was doing a fine job so I just tucked the information away for later reference. Chances are I could have driven that from a 5V supply directly without a problem, but it might be necessary to change the current limiting resistor to match so you keep the current the same.

Now we can move on to finding the signals from the sensor output. Remember that I mentioned the sensor will have 3 or 4 pins on it’s output side. Two of those pins will give us the signals we want. The remaining one or two pins will be connected to GND and/or Vcc. Now that you know where those pins are at the connector, you can trace those to find the pin(s) they attach to on the output side. The two pins you have remaining are the signal pins you’re interested in. Again, trace these back to the connector and make note of them as “Phase A” and “Phase B”. It doesn’t matter which is which, but it’s important to differentiate between them.

Encoder Circuit Board Component Side

Encoder Circuit Board Component Side

 

Encoder Circuit Board Solder Side

Encoder Circuit Board Solder Side

 

Once we’ve identified the power supply and signal connections we have to decide how to connect to them.  You could solder directly to the encoder board and use a variety of cable/wire types. Keep in mind however that if the encoder reader is in motion as it will be if you use the reader on the print head that you’ll have to factor that in to your choice of wires/cabling and how it’s going to run.  Ribbon cable may work very well if you can isolate the flex from where it’s soldered to the board, otherwise the wires will break very quickly.

Since the problem of transmitting power and signals to/from the encoder reader has already been solved by the designers I elected to use the flat flexible conductors already in place by tracing the signals back to the logic board and tapping into them at convenient points there.  Do what makes sense for your situation.  You can use a standard multimeter to trace the signals.

If you plan to power the encoder board from a seperate power supply, then don’t forget to isolate it from the rest of the logic board by cutting the traces on the circuit board or by other means.  If as in my case you’re reusing the printer power supply for that purpose, then all you have to do is tap the 0Vdc (common) and two signal traces for use with EMC2.  You’ll notice in the pictures below, I’ve tapped four signals.  The black wire is for 3.3Vdc supplied from the printer itself.  I just added this as I was using 4-conductor phone wire for the purpose and thought it might be useful down the road, but I’ve left it disconnected at the far end of the cable.

Logic Board and Flex Cables

Logic Board and Flex Cables

Logic Board Flex Cable Connectors

Flex Cable Connectors

 

 

Logic Board Connectors

Connectors

 

Logic Board Back

Logic Board Back

Logic Board - Tapped Signals

Tapped Signals

 

 

 

 

 

 

 

 

Once you’ve managed to trace and tap into the signals as indicated, you can reassemble and connect the circuit boards, print head, encoder reader and encoder strip, motor and drive belt so everything is ready to run though not yet connected to the PC or h-bridge driver.

To test that you’ve tapped the right circuit traces, apply power either by turning the printer on of if you chose to use an external supply, apply power as planned.

Now connect a multimeter (on DC Volt setting) with the negative lead connected to you 0Vdc and positive lead to one of the two phases. If you have one an oscilloscope, you can use that instead.

Note the voltage read by the meter, then move the print head by hand.  You’ll see the voltage fluctuate.  When you stop moving the print head, it will settle either high (~5Vdc or ~3.3Vdc) or low (~0Vdc).  Then move the head again, and again when you stop it will settle either high or low.  What the actual values are isn’t as important as the fact that the values change as you move the head.  If you don’t see the value changing, then just gently tap the head with you finger either left or right, and see if you can get the value to change.

Once you’ve proven that you have a changing signal on the one phase, then you can move to the 2nd phase and test it similarly.  As an experiment, I’ve done up a quick video of the testing just to illustrate the encoder testing.

[youtube id=”_0Kd-JzLWS8″]

Logic Board Motor Driver

Logic Board Motor Driver

 

Just as an aside, you’ll see in this photograph some blue wires.  I initially added these to tap the signals for the on-board motor driver so I could have gotten away without an external h-bridge motor driver, but I found that many printers have proprietary motor drivers or at least ones with custom part numbers which make it more challenging to repurpose them and that would have been an unnecessary obstacle to our goals here.  I did manage to find a schematic incorporating the Allegro A6628 as seen here, but this doesn’t seem to be and IC that’s available to consumers so what we learn will be of limited value.  I may sometime in the future see what I can do with it, but for now the blue wires are just soldered at one end and abandoned in place.

 

 

 

Next Time

Now that we have a mechanism all prepped and we’ve learned what we need to about the electronics, in the next installment we’ll hook it all up to EMC2 and start the process of integrating the electromechanicals with the control system.

Toronto Hydro Outage Map

Outages Early on 2011/06/09

Earlier this week our area was hit by a couple severe thunderstorms.  Of course this resulted in many areas having their power knocked out including my office.  During the follow up to having all our servers taken offline when the UPS batteries were exhausted I was following the progress of Toronto Hydro with this nifty outage tracker.

Along a similar vein, over at EISO you can follow energy generation and consumption in Ontario in pseudo real-time.

Also of course when the weather looks suspicious I have to check in with the local doppler radar.

Galvin over at On Shoulders has started his new season with OpenSCAD for 3D printing.  While historically I’m a SolidWorks user myself, I look forward to this offering and trying it for myself.

Stock lock key, tumber and 3d printed keyNirav Patel looks like he likes to play with some diverse toys and has shared much at his blog.  Lately it seems he’s taken to 3D printing and offers a some useful tidbits in Physical Keygen: Duplicating House Keys on a 3D Printer.

 

Also, WeatherSpark.com is something I’ve been looking for a long time.  Thank you StumbleUpon!  It’s an easy to navigate way to have a look at historic weather data.  I don’t know how much it covers, but in my area it goes all the way back to 1980!  Looking at temperature, precipitation, cloud cover, thunderstorms and more!

Geo01005’s RepRap Ideas details some of his work around running a repstrap using EMC2 from a couple years ago. He’s documented some of his work around the hot-He also has a YouTube channel.

Andrew Angellotti is founder of spingarage LLC has a new blog that’s looking pretty interesting.  Here’s the first part of a tutorial on brushless motor control.

Tim has a great collection of posts on repstrapping over at BotHacker.

So again I wanted to work on putting together the next piece in the EMC2 Servo lab series tonight only to thwart myself.  I shot a bunch of pictures last night with my newly rehabilitated camera. When I sat down today my iPhoto library was kinda corrupted so I decided to rebuild it.  Well right there I lost about 3 hours of access to my pics so I decided to play around a bit with iMovie instead as I know I’ll want to include some video later on, so here’s a quick demo of my apparatus cycling.

[youtube id=”kpGAjKVLZgA” w=”240″ h=”190″]

Solarbotics Compact L298 Motor Driver

Assembled Kit (screw hardware not included)

Based on the venerable L298 Dual H-Bridge , Solarbotics has put together a really nice little kit for low-mid voltage level motor control applications.

You trade a little sweat equity for the few bucks you save over other offerings by fully assembling the kit yourself.

One of the nice bits about this kit is that it includes a 5V regulator to supply the logic portion of the L298 natively instead of relying on a 2nd supply voltage to the board.  This helps to make it very easy to drive either 2 DC motors or a single stepper motor from a microcontroller or other control device.  continue reading…