Sunday, January 22, 2017

TI DRV8825: There's no place like nHOME

I was comparing TI's DRV8825 and DRV8811 stepper motor drivers when I found a "hidden" feature I hadn't noticed before. Both drivers have an "nHOME" pin that goes active only when the stepper motor is at a specific angle (45°). I immediately thought of several uses for this pin.
The simplest application of the nHOME pin is as a check for your 3d printer's steps/mm settings. Calibrating that setting is critical for producing dimensionally accurate prints, but there's always a bit of guesswork involved. Most cal guides include a complicated function that multiplies step angle by microsteps, # of teeth, gear size, etc. I prefer to skip all that and just print 20mm calibration cubes and adjust the steps/mm with the error. Neither method is very precise, since there are many other factors involved in the final output, like filament diameter and flow rate. But I've found that if you calibrate the extruder motor first, and don't change filament between measurements, my method can result in less than 1% error (when you use a measurement tool with less than 1% error, of course). Regardless of which method you use, the motor parameter is always a constant. A stepper with a standard 1.8° step angle has 200 steps/revolution. It's set in stone. But when you enable microstepping, does a revolution still equal 200*mstep factor? If something is wrong with your driver setup, and your motor is skipping steps, you won't see it until you start printing, at which time there will be a bunch of other possible causes. (If it sounds like I am familiar with this problem, it's because I am. Intimately.)
Being able to verify how many step pulses equal a full revolution of the motor would be a very simple and handy tool in our toolboxes.
The other, and most interesting, application is for closed-loop motor feedback. With no additional components at all, the nHOME pin could be used to verify the motor hasn't skipped steps during printing. It wouldn't be very precise, since you would only be able to check it once per full revolution, but it's still better than no check at all.
Where this really starts to get interesting is when you couple the nHOME pin with an encoder. The most useful (and expensive) encoders report "absolute" positions, meaning they give you the exact position at any time, even at power-up. The cheapest encoders only report "relative" position. Relative encoders tell you how many pulses the motor has moved forwards or backwards. If you stop counting pulses, or power down the system, you don't know where the motor is, and you need to home the motor to get a "zero" position to start from. (This is how most 3d printers work, today, minus the encoder. The system counts how many step pulses it sends to the motor in each direction, so it knows where the motor "should" be, as long as it didn't skip any steps). I've also seen "hybrid" encoders that combine a relative one with a simple two-state detector. You can use the simple detector to give some context to the relative pulses; I've seen kinds that pulse once per revolution, and other types that are on for half the rev and off for the other half. The nHOME pin functions just like the former, meaning you could always correlate the physical position of the motor with the relative pulses. You could even use it to automatically calibrate the encoder, since a relative one still requires a "pulses per distance" number to be useful. (If you're repurposing encoders from other sources, you may not know that exact value.) Counting encoder pulses that occur between two nHOME toggles means you know exactly how many pulses occur for one full rev of the motor! Throw in a move to the endstop to get a zero postion and you'd be able to know the exact position of the motor carriage, (along with the exact angle) at any time! Good stuff!
Unfortunately the nHOME pin isn't broken out to a header on Pololu (or clone) DRV8825 boards, but there are several that nobody ever uses. I'll do some research and see if one of those pins can be swapped out for nHOME.

Saturday, January 7, 2017

Filthy Treasures: Kindle 2

I scored this Kindle 2 for $10 from Value Village before the holidays! I've wanted to do a project with an e-ink screen for a while, but not enough to go out and buy one just to hack. This one works great, other than the battery not holding a charge (to be expected with something so old). I intend to use it tethered, so that's not a deal-breaker. The physical keyboard is actually preferrable for my intended use, (a portable serial terminal, if you were wondering).
While checking it out I even found a feature I've been wanting forever: text-to-speech! This model will actually read your ebooks to you! I've had a Kindle  Paperwhite for a few years, and I'm not sure newer models even have this feature.
I love a great thrift store score!

Saturday, October 8, 2016

Cube3 teardown - Electronics

Here are some pics of the LCD and controller boards in the Cube3 during my initial teardown. (I found it strange that I couldn't find any detail of what the MCU and motor drivers were for this guy while I was researching it online.)

To get to the controller board and LCD, you must remove the outer shell of the printer. I simply followed the teardown steps from the OpenBuilds forum thread.

Cube3 with outer plastic shell removed.

To get the front shell off, you have to disconnect the cable to the LCD first.


The LCD and button board are attached to the front plastic shell. To remove the board, unscrew the 4 small Phillips-heads (and don't lose the button, it's not connected to anything!)


It looks like a 3" LCD from a cell phone, with a 4-wire resistive touch screen. A company called "Lincoln Technology Solutions" made the module.  


There's a 16-pin QFN part on the module that is probably the controller for the backlight. I assume the interface to the LCD itself is SPI, considering the small number of wires. 


The main controller board has 5 motor controller chips on it. One for each axis and extruder. 


The motor controllers are TI's DRV8811. The 8811 seems to be the little brother of the much more common DRV8825. It supports a peak current of 1.9A and 1/8th microstepping, compared to the DRV8825's 2.5A peak current, 1/32nd microstepping. (I've read that the DRV8825 really shines at 24V, which would explain why this system runs at that voltage instead of the more standard 12V.)


The biggest surprise of this teardown was the make/model of the controller micro. Instead of running on the prolific AVR architecture, which powers almost all hobbyist 3D printers at this point, or an ARM Cortex M3 or M4, which are the up-and-coming contenders, the Cube3 is powered by a Microchip PIC32! That's definitely a shock. The PIC32MX695F512L is an 80MHz MIPS M4K micro with 512K of flash and 128K of SRAM. The peripheral set, other than USB host, is about equivalent to an AVR/ low-end ARM: 16-channel 1 MS/s 10-bit ADC, 5x 16-bit timers/PWM, 8-channel DMA, 2x comparators. The kicker is it's priced around $10/each (in single quantities)... which is what an AVR MEGA2560 costs, and is probably double that of an ARM. (The M3 in the Monoprice Mini is less than $1 per.)


The wifi module is also made by Microchip. (I didn't look this one up because it's not exciting.)


There's also a Bluetooth Low-Energy module on the controller board. I haven't used the mobile phone app for the Cube3, but that's probably what this is for.



3D Systems Cube3 - Post Index

I'll be doing a series of posts about 3D Systems' Cube3 printer. I've been posting a lot of info in a Facebook group, but the post is getting long, and not easy to navigate. So I'll be re-posting that stuff here, along with all my new investigation. Since I already have a large backlog, I will probably post things out of order. This post will act as the "table of contents" for all the posts, so it will be easier to find what you are interested in.

01 - Cube3 Intro and Resources
02 - Cube3 Filament Cartridge Intro
03 - Cube3 Print Bed and Quality
04 - Cube3 Filament Cart Teardown
## - Cube3 Teardown


## - Cube3 Filament Cart EEPROM Reading

Saturday, July 23, 2016

SMD Capacitors in Bulk

I'm planning on adding a SATA connection to my Pogoplug Mobile, possibly promoting it from "thing in a box that I've already hacked and become bored with" to NAS box I would use daily.
(I'll be using this thread as my guide, although it's a bit sparse.)

The only thing in my way is a little SMD soldering, which is more of an attraction than anything else at this point. Unfortunately the mod requires adding some 0402 components, which is not a size I have on-hand. But take heart! It just so happens I am in the middle of assembling an order to Digi-Key. (I usually order from Mouser, but Digi-Key has a larger selection, and it just so happens this time aroudn I need some stuff Mouser doesn't carry.)

If you're never ordered from an electronic component retailer before, they normally offer large price cuts the more you buy. Often they won't even sell you less than an arbitrary minimum number. (If you look up a part on findchips, the lowest price is almost always at Verical, the "clearance aisle" of Arrow, but you have to buy several dozen to get that price.) This is the reason why we need services like Tindie and Kickstarter, as everything in the electronics industry operates this way, making it prohibitively expensive to make only a couple of anything.

I'm well aware of how this all works, but when I went to hunt down some 0402 caps and resistors this morning, I found the bulk pricing on them very odd.

Their price for a single 0402 10nF cap is 10 cents. Seems a bit excessive, but you always get gouged for small quantities, and they are X7R (low variation over temperature) and a name brand. I only need maybe 5 caps, but I've learned that the smaller a component is, the more spares you should buy. So I should probably buy around 10, then. The bulk price when buying 10 or more drops to 1 cent each. So let me get this straight, buying 10 of these caps is exactly the same price as buying just 1. How is that possible?

I looked at the next tier up; when buying 25 or more, the price drops to 7/10 of a cent each, making buying the minimum for that tier a total of 18 cents, which would be less than the price of 2 single caps. The next tier up is 100 caps for less than 5/10 of a cent each, with the minimum purchase a grand total of 47 cents.

So I could buy just the 5 caps I need for 50 cents, or I could buy 100 caps for 3 cents less.
Makes perfect sense!


Sunday, March 6, 2016

Dirt-cheap filament dryer.

I've been killing myself trying to figure out an easy way to dry out my PETG filament. (My big printer is in the garage, and the filament absorbs the moisture in the air so quickly that it's almost unusable if left out overnight!) I stumbled on the plans for this dryer on the Taulman site, otherwise I probably wouldn't have trusted that it works.
I'm using a 40W halogen globe, and it stays consistently between 100-105°F. There's room for two spools, and after a good 8 hours in there, my PETG is usable again!
(And it's much easier to build than a toaster oven/SSR/PID controller setup).