This 'blog' is the result of discussions had on Doc
Nickel's Tinker BBS. Roger is
my favorite character from Doc's The
Whiteboard and this comic is courtesy of him.
Session 1
Session 2
Session 3
Session 4
Session 5
Session 6
Session 7
Session 8
Session 9
Session 10
Session 11
Session 12
Session 13
Session 14
Session 15
Session 16
Session 17
Session 18
Session 19
Session 20
Session 21
Session 22
Session 23
Session 24
Session 25
Session 26
The End
Appendix A
YDNA
Tracker
Video of the Cheetah in action
Okay if I'm gonna do this I'm going to do it all the way. No pulled punches, no half measures. I'm going to write stuff down as it pops into my head and not go back and edit old information when I discover new things. I'm going to do my best to put you into my head and show you how I think. Its not meant to be readable, its not meant to be entertaining (although I will do my best in that regard) and its sure as hell not going to be terse. I make no apologies.
Post-Session-14 addendum: I want to emphasize (since I've been asked several times in emails now) that you are reading things in exactly the same order I am learning them. I am honestly starting from scratch with a beat-up Halo and nothing more. I run into problems that I am not sure have solutions, but of course I assume they do, Its in my nature.
First things first, gonna need some webspace.
no, first thing is I'm gonna add "gonna" to the dictionary so that little red squiggly goes away.. ahh... Okay now where to put this? I'll keep it simple and throw it up into a personal directory on northarc. okay done. Okay a big brick of text isn't gonna fly, need a webcam.. here's one *rustle rustle plug plug install install*

Is this thing on?
Ick that's the jpg compression I'm gonna get? kind of grainy. Hey this thing makes movies? Hmm.. will have to use that capability. Now where was I. Oh yeah the loader. Well I have to mow the lawn before I lose the light so I'm gonna go do that, this was just meant as a way to throw something down as a format. Guess I'm not unhappy with it. Next session will be in an hour or so after I mow, barring other distractions.
I'll be using my mow-time to do some brainstorming (actually been thinking about this project off and on for half a week now). Before I go how about a quick shot of the workshop and the subject:


.. back from mowing.
Okay put on some appropriate music, start up the A/C (I'm hot as hell from that) and lets start.
Okay looking at the basic shape it seems like it should be able to handle more balls than it does, I've heard it mentioned a few places that it doesn't hold enough balls, but I think if that were really a problem I'd hear about it more. Doesn't look like any real effort was made to deflect paintballs, just a generally rounded shape.
Hmm.. I think I see the problem here, balls have to roll into the sump, which is as low as they could make it, but that means that the reservoir needs to be completely above it, LOOKS like there is more room for paintballs on casual inspection but actually not that much space here for them, guess they didn't want a rock'n'reload type hopper :)
Seems like the functionality of this thing is pretty straightforward, drive cone is spring loaded.. hmm why not a slipper clutch? Seems like that would solve this problem more effectively. Guess a drive belt is suppose to do that job but I understand it needs to be greased regularly to have that effect, and the manufacturer does not tell you to do that so it probably wasn't their intention. Well a consistent slipper would be difficult to manufacture cheaply and might require individual TLC, on the other hand who can mess up a coil spring? Especially if you can make that work.

Whirling vortex of doom for paint.
On second thought the spring is necessary, otherwise the motor would have to respond instantly to a fired ball, and that's never going to happen. Essentially this thing is a continuously self-replenishing spring-loaded magazine. clever. So in a perfect world what would be the job of the controlling electronics?
1) Keep the spring wound
2) Whenever the spring starts to unwind, start the motor. The faster the spring
unwinds the faster the motor should be run.
3) Detect a jam and reverse as necessary.
4) NEVER let the spring fully wind or unwind.
Lets see *fiddle fiddle* the spring is not nearly powerful enough to back drive the motor, good, was afraid I would have to do some kind of holding torque. I'll bet $1 that most of the bad battery life that most people seem to have (but not all!) is due to two things:
1) The people who get good battery life don't fire much, or fire in such a
way that the HALO was optimized to load for because;
2) If the HALO stalls its going to suck down batteries like Doc sucks down Mt.
Dew.
I'm going to go on the assumption that stalling is always bad all the time and it should be detected. The more I think about this the more it becomes obvious that I'm going to need a current-sensing circuit in this board. rats. was hoping I wouldn't. Okay sensing current is something you do by reading voltage and then running V = I/R backwards. Easiest way is to measure the voltage drop across some component that you have to have anyway, in this case that's going to be the N-Channel switching FET.
Wait a minute. reverse the motor? yikes. To do that in solid state requires an H-bridge, they are inefficient in their simplest form due to the necessary pair or P-channel FETs, and in their more complicated form (with voltage-pumped N-Channels all around) are way more complicated than I wanna design unless I absolutely have to. I wonder if I can use a relay. Probably need to hold half an amp at least, what do they cost?
[browsing electronics components]
HMM.. solid-state relays? heard of them but never used them, wonder how well
they work.. pulling up a data sheet on one..WHOA cheapest one is $11 quantity 1,
holy last-resorts batman..okay these are a bit better, OMRON triac 2A .. two
amps? hmm.. if it stalls it'll pull more than that, does it have overcurrent
protection? Bah never mind none of them are in the voltage range I need.
Anything on google about their practical application?
http://www.opto22.com/support/faq/faq220.aspx
http://www.crouzet-usa.com/faq.shtml
Seems they leak current and don't entirely turn on or off, probably not the best thing to use in a battery application. Well I always suspected reversing the motor was going to be too much of a hassle, any canned solutions for an H-bridge? hmm..I like this one- http://home.cogeco.ca/~rpaisley4/HBridge.html supposed to be for model trains? what's an LMD18200 and can I get one in surface mount..ACK they're $11 from digikey.. this is going to be one expensive board if it has to reverse. Big component too, only in DIP or some kind of bizzare TO-220. Really nifty though, everything built right into the chip.. wonder if there is a lower-current version of this that is smaller and cheaper, I bet there is.. but this is a plough horse I only need a pony.
What are the specifics on THIS little wonder.. http://www.zetex.com/3.0/pdf/ZHB6790.pdf 2 amp continuous.. looks like its just a bridge though, will have to supply my own drive currents.. but what are they..no suggest circuit but its a pair of NPN and PNP's, probably not efficient, and will require 4 external resistors at least. I almost want to order one just to play around with it and see if it would work.. how much current does this motor draw, anyway? time to find out, to the power supply!

E-Bay, is there nothing you can't do?
A good power supply is an absolute must for any kind of electronics work, they are expensive, but worth their weight in gold. buy a good one and never worry about power, this is an HP E3610A I got off ebay.. 5 years ago I guess, and its current protection has kept the smoke inside many a project.
okay 6 batteries is.. 1.5 x 6 9v? duh same as a 9v, 6 sub-cells.. okay dialed in and setting the current protection for 2A lets see what this sucker draws.
wow... it draws.. a LOT.. its pulsing the CC light on my power supply but seeming to draw an average of half an amp? stalling it.. pegs the power supply current capacity and drops the voltage to 6v to compensate.
I don't know if I believe that. I know small DC motors and that smells like too much. I want to see what the actual motor would do.. time to take this thing apart. Hmm machine-screw with nut inserts, classy, no 242 though, I guess that's expecting too much, well its not like these things have to survive the sorts of vibration I'm used to in my other hobbies. Oh I take it back, there is some sort of thread locker on a few of these. long screws all the same length? yup, good.. a lot of thought went into this design I can tell, lots of the 'little things' that bug me are not here.

So this is the heart of the unit? If I had seen a Clear hopper first maybe I'd
be less surprised.
I take back some of what I said on capacity, it seems the internals were designed around the battery pack. For the kind of bread this loader goes for, I think it would be reasonable to make the pack rechargeable and lay it down 2x3 instead of 3x2 tall. then provide a 12v AC adapter trickle-charger. I know I would side-load the batteries so the door would not have to support their weight, especially considering how often the cells are going to be changed, given the current draw. At least I'd make an optional "recharge kit" for like $19.95; including shrink-wrap nicaads and the adapter would probably provide plenty of margin all around.
But I digress. Looking in here my first impression is decent, feed-neck is well supported, design is modular and I see some tape I assume was used while moving the finished modules between assembly stations, or just added by a previous owner, this is a [well] used unit so no telling.
Electronics have 2 connectors going to them and some kind of plastic backing.. eye components are held in with electrical tape? Fine solution to the problem, doesn't look pretty but will do the job well, someone who thinks like me was involved with this design. Plugs are not keyed, note orientation.. (two red on right, orange on left)
Looks like the back panel should just come off but it seems to be captured.. hmm just sticking maybe? yeah just a tight fit. egads what have we here? Molded plastic with a sticker on it for an on/off switch? this will never do. will definitely poke a toggle through there. hole is big enough for a pcb-mount subminiature, will have to check tolerances later with a caliper. light aperture is adequate.
As for the board itself, Motorola microcontroller? Why not, I remember fondly my BUFFALO days. betcha ten cents this connector breaks out the JTAG port. what have we here, a pot, some resistors, transistor or three, 2 8-pin ICs? what are they.. a 4435.. I think that's an opto-isolated FET of some kind.. [google] yup thats it.
Motor is a pretty beefy (for this app) DC brushed, reasonable choice, what might have been interesting would be a stepper motor :)
Eye components are discreet with no pre-processing, good. I was thinking to run them into a A to D converter rather than the standard Schmidt-trigger. In this way I plan to have an auto-calibrating eye that will watch for highs and lows, draw a line down the middle and be immune to paint-shell differences. I've held off doing that with a KM2 board since break-beam is the "right:" way to do it.
So what does this motor REALLY draw at 9v? Well how about THIS.. quite a bit faster at 9v.. in fact its smoking.. and only pulling .6A! Stall current? Seems to be plenty powerful and only suck down 1.4A Is 9v too much? whats this motor rated at? I wasn't going to pull it open but now I'm curious.
Whats the deal? *ponder* My theory is going to be that the circuit is making some attempt at softening the motor torque up, but I do not believe this to be the best solution. The only way to do that draws excess current with all the hard switching, and its inefficient. Plus is lowers your overall drive power. Time to look at some waveforms on the 'scope and see what switch-magic they are pulling

Wow! Electrical 6-Flags action here.
What a mess we have here. Looks like a constant-voltage drive of around 2 volts, with a 9v spike every 5 milliseconds. Maybe a chopper drive? not like any I've seen before but I think I'm about to learn something. Seems like as the motor is stalled the high-current portion of the waveform lasts longer, the 9v spike comes down to 4v instead of 2 and holds there for 2 or 3 ms (climbs steadily until it reaches almost the full 5ms then the whole board shuts down. When free-spinning there is also a brief full-voltage spike every 2 or 3 seconds.
Very interesting. Clearly the designers are worried about crushing ballstacks because this motor/battery combination has the power to slam balls home much faster than this loader loads.
I don't fully understand whats going on here but I don't want to waste too much time in analysis, I expect that I will re-discover what the designers of this board figured out soon enough, but in general I have great success starting from the super-simple and going forward from there.
Back to current-sensing. Going to have to sense current drain, and I bet that the difference in current drain from unwound spring to fully-wound spring is going to be practically nothing, combine that with manufacturing tolerances, swapped gear sets and motor wear and I'm quite sure it will be impossible to detect spring tension via current readback. HOWEVER current-check is definitely going to be necessary. (Note to self, try it anyway, ya never know!)
This is going to be a delicate algorithm, the motor chosen for this loader appears to be about three times as strong as it should be, judging by how far down the torque has been dialed via electronics.
From here I'm going to design and build my first prototype. Its going to have an A to D for eye sensing and a single N-channel FET for PWM speed-control. high frequency if I can manage it.
I have a lot of thoughts on how the eye is going to work but I'm bushed and there is some Kung Pao chicken calling to me.
Just got done watching a DVD and chowing down on some hamburger helper. Two thoughts, one is that what I really want is a variable constant-current power supply driving this motor, and second I don't need a line down the middle of the eye voltage, I don't care how high it goes, I just care when something is or isn't in front of it. I'll make sure there is code in the final product to watch that lower bound for funny business and advertise it as a digitally self-calibrating eye, allowing it to see dark-shell paint. I realize knowing whats behind that kind of copy takes the glamour out of it, but consider it like a magic trick, once you know how its done, you think "thats.. it?" and the magic is gone.
Back to the constant-current power supply. I bet there are canned circuits for that out there and I can pick a proven one. Might involve a feedback op-amp and a few odd components. I'm really tired now but I gotta do some research on this or I won't sleep.
*researching*
Hmm all the decent circuits require resistors in the 2-10 watt range. Those are the big white bricks. I might be able to fit one on but that doesn't feel like the right solution. Guess I'll just have to build a high-frequency pulse driver tomorrow after I get back from Ultimate Paintball.
One last check tonight and.. oo.. I'm in love! http://www.freescale.com/files/analog/doc/data_sheet/MC33887.pdf
THATS IT! Integrated current sense, 5A capacity, fully reversible.. mm.. can only modulate at 10khz.. that's not so good.. but with the current-sense it may be enough.
Curts rule #1 (inspired by Douglas Adams) "Figure out a way to make your application sound like a million other applications, and you will find single component that does the whole job for you" -- (Douglas Adams rule was that the universe is so mind-bendingly huge that nothing needs to be manufactured, because somewhere on some planet it grows naturally.. like mattresses)
Just got back from Ultimate Paintball and was thinking a bit more about the on/off switch. A toggle might not be such a good idea. I think I see the problem HALO was trying to solve with the membrane-like pushbutton. That panel is hanging way up there and is going to get hit with paintballs, direct hits, its a given. A toggle switch might stand up to that, then again it might not.
So the board needs some kind of on/off input that is 300fps-paintball proof? *ponder*
- Could make it switch on when the eye voltage changes? nah if I A/D it then
I can't make that sleep-interrupting interrupt driven and that means power drain
when "off"
- Relocate the switch? nope that chamber looks pretty tight, nowhere to hang a
switch out
- Maybe switch the batteries? more than a stone's throw from "drop in"
if I do that.. besides hwo does that help? It moves the switch to the front
of the loader, dumbass (speaking to myself, yes I curse at myself when I think
of something stupid)
- Sound activated? could hook a condenser mic up.. nah too expensive, board is
already looking like its going to be pricey. Plus who wants a loader you smack
to turn on? that wouldn't be right.
- Recessed toggle? can I get a switch that fits in there just right? Probably,
but I don't like designs that rely on tolerances that close, they haunt ya
- Momentary toggle? Nah same problem
Then again, the hole in this thing is pretty big, maybe a short toggle is an acceptable solution, time to take some measurements and see whats out there.

How big is this hole?
Hmm.. call that .3" in diameter, .11" inches thick (extra thick, I bet I'm right that this was specifically designed to stand up to paintball hits, I mean 'duh' but it took me this long to figure that out, eh?) and its distance from the PCB when mounted.. gonna call that .225"
Okay off to the datasheets to find a switch that fits this bill *research*
hmm think I'll make it a momentary, then holding it up will power cycle it, but just flicking it will be "clear jam". Damn these are all expensive.. can't put a $10 switch on this board, margin will be close enough as it is, on the other hand its gotta be a "no one thinks about" component or I'll get roasted (and deserve it).. still looking. I like the S2 technical drawing here http://dkc3.digikey.com/PDF/T052/1215.pdf but can I find a switch that works with it? Nah nevermind, they are .371" tall.. too big.. pushbutton might be the only good solution here! Nope.. the only thing that ALMOST fits is a wimpy little subminiature (same one used on the freestyle, looks like) its illuminated which is cool, but won't stand up to a hit. Sorry but it looks like this is going to be tactile pushbutton. Now to find one *more research*
Have a few good candidates but I think I'll just shoot manike an email and ask for what part they use, that will ensure compatibility. I could get sneaky and stick a rotary switch in there, but actuation would be a problem.. I've seen what these paintball players do to their equipment and its not pretty. Just today I saw a guy slide into his bunker on the break and the Halo popped right off his gun. He hunkered down, put it back on and smacked it until it worked, a few seconds later he eliminated a guy with a very impressive paint rope (damn those shockers move paint!)
I'm hungry, gonna order some Singapore Noodle and think about this switch problem away from the keyboard a bit.
Damn, just got back from a bridge tournament where I got totally owned. I've played better thats for sure.
Couple of thoughts, first I just checked in on the guild and there seems to be a lot of concern over the anti-jam sequence. Keep a couple things in mind:
1: Running the motor at 9v makes it go fast.
2: If its jammed, then by definition the spring is totally wound, so the motor
can be safely reversed for 'x' time with no danger of crushing a ball in the
opposite direction, that time will be small since it can be run at the full 9v
3: once the spring ahs been unwound the motor will move backward until it senses
the current increase, in effect I will be counting on the cone jamming in
the other direction, this is the indication that the jam should have been
cleared.
4: the cone can then be driven forward for the same 'x' time winding the spring fast
therefore:
5: I expect the entire un-jam sequence to take between 1500 and 3000
milliseconds, and be ready to rock'n'roll in something under 2 seconds.
Thats the theory anyway, maybe it will work and maybe it won't, I'll find out in testing. How often does the darn thing jam in the first place? I assume "not often" so it may be a wash, but "auto unjamming" is another one of those features that looks real good to potential buyers.
On to some more important stuff though. I realized I have a big problem to solve, well two really. Number one, how do I detect balls flowing properly, and at what rate? Number two, how do I detect a jam vs. the gun just stopped firing in an awkward place.
Awkward? Yes. I realized (in the shower today) that the distance from the eye to the top of the bolt will not be constant, it will always leave some part of a paintball exposed in the idle position, and if it happens to be between two paintballs, won't that look like no paintballs are there at all? ie.. jammed?
Well I need to find out. Since I am running the eye into an A to D I have a lot of flexibility in this regard, so time to load some paint into this thing and see how the eye responds, maybe an open-tube will look different from two balls close together *crossing fingers*
Now lessee I'm hoping to run this off that bitchin' 3.3v regulator I found for the shocker so lets make this a 3.3v circuit, measure the outputs of the standard board to find the emitter/detector, throw a 5k pot inline on the emitter so I can adjust stuff.. blahblahblah...
First time running this thing with paint in it, seems like no attempt is made to keep the spring under much tension, its just there for safety? Dunno if I agree with that, well we'll see soon enough. Seems orange is the signal, but I don't really recognize what's going on with the other side, seems like they are running line-voltage through the emitter? hrmph, better not blow this thing up, I'll start with something conservative, 680ohm resistor across it. the detector, I'll use my standard 4.7k but guess I'm about to find out what its expecting, seems to be running at.. 3v? Don't have the specs for the Motorola chip in front of me but that seems a smidgen low, oh well whatever works for them I suppose. Hmm.. its being pulsed, that means they are not looking at fire rates with it, jsut "is there anything there" or not. Probobly bodes well for dark-shell detection, since they will have tuned it to detect a dark-shell trough and I can watch for peaks.
Quickie test-circuit has no surprises, running a 330-ohm current-limiter into the emitter seems a bit tame, its drawing just south of 9mA that's a bit high, lets run that 4.7k down a bit with the 5k pot and see if I can get better response. Wires are:
Grey: emitter +
Blue: emitter -
Yellow: detector ground
Orange: detector signal

Helping hands and alligator clips, a hardware prototype's best friends.
BINGO!
At 10k the response is so dynamic that the difference between a ball-intersection and empty-tube is easy to make! At peak detection (ball centered over detector) its 2.5v, between balls is 1v, and empty-tube is <.1v. groovy. I wonder if dark-shell paint reflectivity is so rotten that troughs look like empty tube? I bet not. Need to get some, will have to tour local pro-shops. (mental note) This also means I can figure out exactly how far above the breech the hopper is sitting, if the motor is turning and the ballstack isn't moving, its being blocked by the bolt. mental note- make sure to assume mixed-paint is loaded, don't assume homogenous loads.
Assuming something reasonable like .1 v or less is "empty" anything above it means balls are there, and I can watch the peaks and valleys and determine the exact rate of fire. Next I need to correlate that to drive-cone RPM. Can I get the motor RPM? hmm.. maybe but I doubt it, there are some tricks about looking at the back-EMF to see when armatures pass by, but I'm going to assume that won't work reliably, especially considering that requires knowing the exact gear ratio.What pops into my head is having at least 3 modes, standard, fast, and damn fast.
So the eye is good-news city, I'm planning to bias with a 330ohm on the emitter, and 10kohm on the detector. As an afterthought how does the 680 do? *tinkertinker* bah too soft, stick with the brighter one. This does commit the circuit to a 10mA draw, but *shrug* its already running half an amp to the motor, who cares about an LED.
Okay if I write the algorithm correctly I think I can detect jams, feedrate and motion types just by sampling the eye and massaging the data. That's the good news I was hoping for. Next up is motor drive, this is the second biggie.. can I reduce the torque with a standard high-freq square wave modulation? Will lower speed equal less torque? Yes but how much.. and how sensitive will the current-detection be? Can I figure out how to keep the spring wound? Can I run the motor full-bore and stop in time? Sudden 50ms reversal keep balls from getting squished.. nothing but questions.. need to build a motor driver circuit tomorrow and find some answers.
I'm not there yet, but I'm closer than I was 2 hours ago. Motor tweaking tomorrow. Need to sleep on some stuff.
Damn I must have been up late, I'm not putting "end of session" tags in here but last night I think I got done around 2am. There is a lot of time-compression in those *tinker* thingies, just in case you think it takes as little time to do this as it takes to read it :)
I ordered some Diablo Midnight off Amazon- http://www.amazon.com/exec/obidos/tg/detail/-/B00064YGPU/103-0335531-9772629?v=glance $13 seemed reasonable for 500 balls I guess, I had choices of color, none of which were black, so I picked purple assuming it would be the worst. If I get purple-shell paint then I guess shame on me.
Its mother's day, first order of business call Mom and arrange lunch/dinner with her, sister and dad..*ring* Hmm.. lunch at Copelands, I love their shrimp etouffe.
Not much time to do anything today, but this has been eating me all night, I want to see what the response of this motor is to various 9v 10kHz PWM speed control signals is. easiest way to test that is with a Morlock Its got enough current-drive to easily handle this job, and conveniently I can reprogram them to do anything :)
Okay writing up a quickie pulse-drive program.. hmm.. this just occurred to me and I can't imagine anyone wanting to know this, but time to use my netcam to make a silly, nihilistic movie. I'm going to record the keyboard as I write this program, and then post the program, this may be the stupidest thing I've ever done, and please forgive me if its of no interest to you, as I strongly suspect it will not be, but I'm just dying to use the movie-making capabilities.
Here it is, the movie and the program. No I don't normally talk out loud when I program, that is for the camera's benefit only, I was just saying what I was thinking. Although I do think with my hands. The movie is 73 megabytes and I doubt its worth watching. I only include it here because I sort of promised I would. The output of the program is as expected-

A pulse. I took a picture of a pulse. What am I thinking?
A 20/256th (8%) duty-cycle pulse coming out of FET_1. By the meter its 3.8 grids x .5ms scale = .0019 inverted is 526 cycles per second or half a kHz. The H-Bridge can withstand 10.. wonder how many different speeds I could get if I did that (in this case I have 256 separate speeds, from 0% duty cycle to "ON")
Some math and I find out that at 4MHz this PIC can modulate at 10kHz (with this algorithm) and only provide 13 speeds. That may be enough and it may not, and 10kHz might be overkill anyway. Time to hook it up to the motor and find out.. oh hell no its not its mother's day, how would I explain THIS? Easy she's my mother and she knows me :)
But alas further experimentation must wait, I'll try and spend some time on this tonight but I have other projects that need time.
Hooked it up and found a few interesting things. If I set the duty cycle to around 14% the motor spins reasonably well and can barely wind the drive cone spring halfway, 11% and it moves the motor but can't turn the spring, nice to know. Faster duty cycles of course run the motor quicker. I'm working up a state-chart for this program on a whiteboard. Normally I just do it in my head as I code but I'll graph it out for the benefit of those following along.
I'm concerned about consistency between models though. I'm going to shoot Manike an email and ask about that, if the gear-ratio's or pulley-sizes have changed between models, or the DC motor is even a little different, finely-tuned logic will be too delicately balanced. I need a feel for what I can assume on the average Halo, rather than the one I happen to have here.
Its about time I chose a chip to be the heart of this. I can't use the 16f628a because it has no A to D converter. On the other hand I could use one as the main logic then have an external chip do nothing but A/D conversions and load them into the 16F628. That might not be such a bad idea since A/D conversion tends to be noisy and require sleeping to get good fidelity. On the other hand so what? how much fidelity do I need.. lessee.. if I assume 0-3.3v and an 8-bit A/D conversion that's .012v per bit, but I'll never actually get that with the noise this circuit is seeing, probably hoping for 6 bits is about the best I can expect to do without special effort, that's .05v steps.. hmm if I call .1v or less "empty" that's going to be cutting it close, maybe .2 will suffice.. darn it need some black-shell paint to know for sure.
Still, I expect that will be good enough. Okay how many I/O will I need.. motor drive, H-Bridge control needs like.. yuck.. 6 at least.. oh and I have to do A/D conversions for that one too for current-sense! aww fizzlesticks. I need two A/D converters or multiplex one of them, as I recall PIC multiplexing has minimum setup times, to the datasheets!
*research*
Hmm 16F676
looks like it'll do the job, reasonable price... lessee the specifics.. looks
good, but is 12 I/O pins enough?
1- Power switch
7- Motor control
8- Eye input
10- Dual-color LED (at least)
2 left over for... DIP switch maybe? I've always wanted to add a wireless
controller to KM2 products, maybe this will be my chance?
Cutting it close but it'll do, now about that A/D.. conversion times are what I remember, I'll end up using the interrupt-complete flavor of this I'm sure.. 4us typ. x 11 is 44microseconds to do a conversion. inverted is.. 22kHz nominal. It'll be worse than that though.. may not make this interrupt-driven after all, dunno if I can spare the context-switching! This chip is going to be doing a lot.
But what concerns me is the swapping.. where are those setup times.. 7.2 A/D requirements, here we are.. maximum impedance 10k mental note.. appears to be a sample-and-hold type A/D and that means all I have to do is wait for the capacitor to charge, so I assume the MUX switch time is trivial, better look in the appendices to be sure. that time is defined. Hmm.. not clear if the cap charge-time is waited for on a conversion-start, but the sample calculation shown here has it at 16.47us, assuming I add that and divide by two.. hmm.. I think one A/D will suffice, and I'll plan for that. I'll keep in the back of my mind that I might have to parallelize this to get the resolution I need, and that would mean two PICs, one master and a dinky little 8-pin slave that just converts and sends.
On the other hand if I'm PWM-ing and the times are deterministic, I could do
the work while "waiting" for the pulse to come back high, that's
starting to get clever and I' rather not do that unless I need to.
Time to get to ordering. The H-Bridge only comes in two packages, hard to use and impossible to use. No DIP version so I'm going to be hating life using it, oh well. I can't think of anything wrong with the 16F676 as the brain for this so I'm going with that. What else will I need.. A dual-color LED. Sure why not. I kinda like that 3-color pixel thing the DM4 uses, wonder if I can find something nifty like that, its bright as hell too.
On second thought no, thats sort of a signature part, my signature is fire-blue LED's (at least it WAS, until Smart Parts started using them too, now everyone has um). Still its my calling card so I might as well stick with it. Anything interesting in the catalog? *browse*
Nah not really. Okay order placed. I've got lots of other projects that need my time so I'm gonna shelve this for the moment until the parts arrive in a few days.
I am on remote here at Borders in Louisiana (New Orleans) where I drove to visit my fiancé who is on a job here. On the way down I had a lot of time to think.. about 7 hours.. and I spent most of it on the loader. I came up with the methodology and theory on how I'm going to control the motor.
Okay I figure, what am I trying to accomplish? Back at the beginning I stated that in a perfect world the software would keep the spring partially wound and never let it unwind. Okay I still believe that, assuming this doesn't blow balls past detents, which I have to assume it won't.
So lets look at that buzzword of the software world- Use Cases. For those unfamiliar with the term, a Use Case (loosely defined) is a walkthrough of functionality from an "a does b" point of view. Paintball guns have generally one use case- you pull the trigger and it fires. However an electronic gun with ramping probably has 2 or 3 use cases. Anyways I'll jump in and you'll see how it works
Lets assume I have 3 inputs and 1 output. Input 1 is the presence of balls in the feed tube, which I know with the eye sensor. 2 is the rate of ball passage which I can infer by looking at peaks and troughs of the passing ballstack. This is dicey, maybe I can massage that and maybe I can't, but I think I can so I'll count it. third is current-drain of the motor. This is the one that is going to be the most trouble, can I get a clean, clear indication of how much current the motor is drawing as I modulate it with a high-frequency square wave? I'm hoping so, but this is what I'm worried about the most.
First case is being turned empty: tube will be empty, turning motor will be low-current and tube will not fill. keep wheel turning at minimum rate, since there is no other input that tells us the loader has been filled.
Second case is being turned on with paint in the hopper but none loaded yet (probably most common): turn on the motor and tube will quickly fill then show no motion, turn motor off
.. and so on and so forth. I'll be working up a complete list when I'm back in my workshop.
Thinking through these cases, I tried to figure out how to determine the proper motor rate to set the cone for. Given that I can probably figure out 3 or so 'safe' rates, ie, rates that will not have enough power to fully wind the spring.
Assuming the user never wants to fire faster than a 'safe' rate can feed, the problem is solved, whenever the eye detect motion, engage at a safe rate until the eye shows stop
Unfortunately I have it on good authority that there are many users who expect to fire faster than the safe rate. But how fast? I must assume that I cannot stop the motor fast enough once stalled against the full compression of the spring, so I have to 'see it coming'. I can probably detect the rate of balls through the eyes, but so what? I CANNOT directly relate that to motor speed, its not a stepper and its not encoded.. knowing that balls are shooting past the eye at 21/sec does me no good because I can't "set" the motor for 21/sec and I'm not sure that I'd want to.. wouldn't 22/sec be better? ie- preload the spring to half THEN ramp down to 21/sec.
I went in circles on that until the Mobile River bridge, when it suddenly occurred to me what I was really trying to do. I want to find the 'sweet spot' of motor current that is above free-spinning (spring uncompressed) but below stall (spring completely compressed), essentially like setting the drag on a fishing reel, and that this point should be fairly easy to detect.
Lets say I select 10 speeds or 'gears'. low gear will probably be like 12/sec and totally safe because it only half-compresses the spring, I'll run this speed always, UNLESS: the current drops to a pre-determined rate that I know to be free-spinning.
At that point I'll raise to the next gear and watch the motor current. If its still at what I know to be "free spinning" I will raise to the next gear, and so on, trying to find a 'gear' that shows motor drag
These gears can be shifted very fast, and can be validated by looking at the ball-passing rate. Are they shooting by the eye as fast as the free-spinning indicates they would be>
So I just need to measure the motor current. Can I do that? I know I can measure it, but will that number be a jumbled mess of white noise as the motor is violently cycled with a square-wave, or can I filter out what I really want. I'll be with a well-chosen capacitor and rolling average sample I can get it, but the only way to know for sure is to build the circuit
So if the eye detects stoppage for more than, oh say 20 milliseconds, it assumes the gun has stopped firing and downshifts to low gear, maybe even off. That's going to take some experimentation, how low to shift how quickly, how high above 'free spring current' to up shift.. hmmm
There still remains the use cases. feeding at 30bps is fine, but who does that in actual play? Sure bursts with trigger-assist, or woods ball players, but how many balls do you rope out, practically? I have to assume that those who do that want it immediately, and will always stop suddenly. ie- no one shoots a string at 25bps then ramps down to 20 then 15.. they just STOP. This design will live or die based on how fast it can detect that firing has stopped, and not crush a ballstack it was just pushing at 30bps. Lots of experimentation to do.. I'll need a test apparatus, a trapdoor of some kind and a loop-around tube. More than that, I'll need some kind of rate-limiting device. hmf. no I'll just use a shocker set for different rates of fire and rubber balls. No rubber is no good because they will never crush. Looks like I'm going to need some discount paint. *sigh*.
Sorry for the big block of rambling text with no pictures (or spellchecker) but I don't have a camera on me, and even if I did, nothing to take pictures OF. more on this later, I'm really chomping at the bit to get back now and construct some test-circuits. I'm also considering adding a 7-segment display :)
I am back from New Orleans and the parts I need arrived yesterday evening. The H-Bridge chip is cool! I can't wait to design a board that includes it. it has gold leads!

Gold legs! Gold heat-sink! What's not to love!
Sorry its blurry, this webcam has very limited macro capabilities. I also received some sample black-shell paint, and an e-cocker frame for BPS testing! WOO! Thanks for the donations! (ahem.. okay I have to give the cocker body back, rats..)

can't wait to test with THIS baby.
Getting back from a long-weekend away from my computer (sort of) has caused a great heaping pile of work to come crashing down upon me. I'm expecting to be able to do a session with this tonight but no promises.
Incidentally, if you've actually read this far, not skipped ahead, then you have a problem. Its a tinkering problem so severe you'll actually watch someone else tinker. Its too late for me, I'm blogging about tinkering and that's the final stage, but it may not be too late for you. Find a party, take a walk, maybe force yourself to use some piece of technology and not ponder what its individual pieces might be good for, or how to make it better, or what kind of bracket you would need to mount it inside your car. Turn away from the abyss!
Lets get this puppy built. I grabbed a few thing I knew I was going to need at the local RadioShack, namely a small project board, a few sockets and some capacitors. No telling what I'll need to suppress the voltage spikes.
aww fiddlesticks I grabbed the wrong socket, this is an 18-pin and I need a 14-pin. No worries, I'll just use the top two slots for a decoupling cap and .. something else, we'll see as things progress.

Knew I should have checked twice.
Hmm.. no I'll shave it, this board is going to be tight, as I actually want to get it in the loader for testing. lessee.. *trim* *cut* *snip* *grind* *solder* and viola, complete with .1" header couplings for the connectors. Now to make this thing messy..

Prototype will fit into the hopper.
Very little room back there for a prototype, going to have to make this extra-clean, and keep as much circuitry on top as possible. yuck. First up- power. going tohave to make this a 5v circuit because that seems to be what the H-Bridge wants to use.. hmm.. wonder if I can use it as the voltage regulator? It has one internally, that would save a component. Rats. its not run out externally.
Reading about this H-Bridge.. damn this chip kicks all kinds of ass.. I think it has internal current-limiting.. how perfect would that be.. An aside here, contrary to popular belief, I do read the instructions to stuff. Particularly when I'm designing with a new chip, I read the entire data sheet front to back, not just a summary of the pins. Too many important tidbits are buried in the detailed descriptions. Remember also that unless stated otherwise, graphs you see are not to scale, they are usually exaggerated for clarity, read the T-times explicitly! I have actually seen two graphs that were out of order based on the setup times, if you went by the graph, your circuit would not work and you'd never figure out why.
Filter capacitor can be up to 33nF? nanofarads? crap that's .033 microfarads.. do I have one that small? I doubt it, I was expecting to need a monster, not a dinky one. quick trip to RS before it closes! (incidentally, there is one within 3 minutes of my house, yes they know me by name)
Back. They didn't have 33nF, just 47 and22. I'll try both
Circuit is built, took about an hour. What a friggin' drag, reminds me of my work with the Gabriel LCD. Gonna grab some Spaghetti and then come back to this and re-check it. Its been my experience that you can't double-check something like this without taking a long break.


Sorry for the mess, had to keep the circuitry on top so the back would remain
clean. Of course
prototyping a surface-mount chip is its own barrel of monkeys.
There, some before/after pics. Does it work? I dunno. Time to double-check it and then apply power and smoke-test it. Oh I guess I should talk about how I built that. The circuit is only in my head, but I take it a pin at a time. I suppose I could draw it out but it would be pretty trivial, stuff like this only looks complicated. I have the two IC data sheets in front of me showing pinouts, then I just run up and down both of them, for example:
H-Bridge EN pin; Look up pin in quick reference, "Enable, active high" okay I want control over that, must run a wire to the PIC, hmm C2 is free, *solder* *strip* *solder* *cut* done. On to next pin.. In other words I just keep reading and studying until I feel I have the whole design in my head, then I build it. I'm not saying that's the best way to go about this sort of thing, but for small circuits like this one? *shrug*
One pin at a time, one component at a time, with lots of back-checking. In my double-check I found that I had wired the detector backward and forgotten the current-sense capacitor as well as the whole lead! duh. Fire it up and... viola! drawing 10ma with the eye on and the H-Bridge disabled, will do some testing with that in a bit but for now, to the Bat-Programmer! Lets wiggle some bits!
First up the A/D channels, how fast can I digitize them? A quick program that clicks a pin high/low upon completion and I get.. 72us to digitize both channels, 36us per channel, okay not bad, that's 27,777 samples per second. now how accurate is it? Not worried about the eye, thats easy, its the H-Bridge current-sense. *deep breath* okay lets turn that sucker on.
Lets say.. 50 cycles, 5 on and 45 off, simple 10% duty cycle, big moment and..... nothing. ? *sigh* what's wrong? There are 3 frickin' enables on this chip, I must have missed one..yup its still in "sleep" fixed and.. high-pitched whine! yay! That's the motor cycling at ~5 kHz but not going anywhere because 5 is too small, lets try 10? Success! Okay it moves but slowly, and takes a bit to pick up speed.. hmm have the direction correct will make sure I can reverse it. 1/5 duty cycle is just enough to wind the spring about 1/3, here is a movie of it
Okay current sense works and I can see a visible rise when I grab the wheel. Problem is the rise is small and it only occurs at the end of the positive pulse. This could be trouble. I'm going to try an experiment, I'm only going to sample the current of the motor after the "on" pulse has completed, that way its had as much time to rise as possible. Then I'm going to pipe out the results of that sample to the remaining pins so I can see what the ADC is seeing. This is where I wish I had a level-converter lying around so I could just run it into an RS232 port on my computer and "printf" the values, which I will probably end up doing, but all I have is the chip and no circuit (it requires like 100 capacitors as charge-pumps and I'm in no mood to wire one up right now).
I'll just *tinker* some more and see what I can shake out of the tree.
- turn everything into sleep mode and the circuit draws 2.2mAh thats pretty high, I'm hoping thats just the voltage regulator.. well wait I don't need to hope.. I can wire one up.. lessee.. 2.16mAh just by itsself, that means when this circuit is "off" its drawing 40 micro-amps. All I gotta do is find a micro-amp 5v regulator and I'm good to go, thats plenty small.
- at 20/25 duty cycle (I think 25 steps will be enough, and the more steps the less whine and smoother the operation will be) the current draw is between .5 and 1v (scaled) seems like .6-.8 is the sweet-spot, that the current the board should try to maintain, anything over that and *bammo* shutdown. much more testing required. still trying to tune-in the ADC
- why can't I get A3 to output?! *check data sheets* "input port.. " not "Bi-Directional" I'll be damned it can't be an output, okay no biggie.
Took a trip up to TAG today to do some debugging and was greeted by James, who had heard that I working on a HALO mod and wanted to know how that was going. *blink*. I didn't say the first three things that popped into my head, what finnaly came out was "An excellent question, how about I dedicate a blog to it!". I think he thought I was being sarcastic. I was also asked, "did you bring it?!". bring.. what? A cobbled together prototype that can turn a motor on? Thats only slightly less exciting than running the batter directly to the motor. I assure you, when there is something to show you'll be the first to see it!
So got back and time to do some exploring. Okay the waveform I have to sample is an inverted sawtooth with an amplitude of .5 to 1v. The ADC is having trouble with it. I think. Hard to tell. Time to wire up some LEDs for feedback.
Done, now I have 4 lights I can blink to show status. Now comes the really boring stuff. program/test/tweak/program/test... blah. I'm going to save the running dialog of how I do this but suffice it to say there is going to be easily 2 or 3 hours of nothing but tweaking and observing the oscilloscope
Oh, something else you might as well know, I have bizarre taste in music. really bizarre. no.. really.. trust me.. *sigh* okay let me put it this way, for the last 3 hours I have had this mp3 on endless loop. I am not kidding. You wanted to know how my mind works? Does this help? Its getting old though, time to queue up Voltron and Mighty Orbots. I make no apologies, I don't know why I like it.. maybe because I can ignore it? I do have much more normal tastes as well, Pink Floyd is my all-time favorite, I also like U2, Phil Collins, that kind of stuff. Yet every so often I'll plug in the Gummi Bears theme, *shrug*. I believe when I mentioned it to Doc once he suggested multiple high-voltage shocks. They didn't work.
*tinker*
I'll take notes here instead of in the code where I normally would
Full Duty Cycle (on) - pulls .58 amps, and rocks out. groovy.
ADC fidelity is very poor. seems like current range is 0-10 with 2 being
"free spinning: and 4 or se being "stalled". yick I want
at least an order of magnitude more than that fidelity, if its consistent, okay,
but I bet it will be temperature dependant.
EEEK, Temperature! I MUST test this in the freezer and the oven. If the current sense is temperature dependant them I better take that into account. I do not expect it to be, monolithic chips like this normally have temperature compensation built in, or mention it in the data sheets.
20/100 barely pulls motor, probably too low to start it
reliably. Better fidelity on the ADC.. I bet I'll need to use a longer duty
cycle to give the ADC longer to sample.
40/200 strong enough to pull slightly past spring, current sense was no better.
Guess this is as good as its going to get. going with a 200 divisor and now
tring to find some benchmarks; will start with "compresses the spring"
mark.
38/200 - barely compresses spring to max
39/200 - teensy bit too strong, going with 38/200 as the "safe" duty
cycle
This is what I'm working with, by the way, I've engaged the second trace on the 'scope and have the two probes set up thusly, the top trace is one of the LED's, which I am switching on just before the ADC sample starts, and switching off just after, to show where the sample interval is. The bottom trace is the "current sense" output from the H-Bridge. This starts low and ramps up over the "on" portion of the modulation, I take a sample right before I turn it off so its at maximum.

As you can see, the top spike is very short compared to the rise time and
modulation frequency.
Time to make these things absolute. Going to sample the timer instead of for loops, this will allow logic to be between the PWM and not disturb it.
*program*
While I'm at it, time to start moving this from test bed to finished code. How about a constant main loop with calls to a state machine? Yeah I like that.. guarantees synchronization. Also moving this to a constant on-time Pulse-width Modulation. That should give me reproducible current readings and be as friendly as possible to the H-Bridge. This may be nothing like the final code, but the core of the PWM/State machine currently looks like this:
for(;;)
{
if ( motor_on )
{
set_timer1(0);
output_low( H_DISABLE );
while( get_timer1() < 300 ) // "on" pulse constant
{
stateMachine();
}
current_level = read_adc();
current_set = true;
}
set_timer1(0);
output_high( H_DISABLE );
while( get_timer1() < cycleOFF )
{
stateMachine();
}
}
This will probably be the last snippet of code I'll post, I've decided that its just not a good idea to post the actual source code to the FLASH board (working title). But I will answer specific questions about it directed to my email
Important Note: This may or may not look anything like the final product, its just a starting point, and I guarantee there will be at least 2 paradigm shifts before its done.
2500 - winds spring 5/6ths, reliable start
2300 - winds spring and slight kick
1000 - good speed, critical 8-11
All seems to be going well, time to add a rolling-average to the current sense and see what pops out the other side. Looks good, taking a rolling average of the last 4 current-readings smoothes things out, I still have very poor fidelity, but it seems reliable, I have to test this with more HALO's to be sure.
Okay time to get serious about the state chart, how am I gonna do that? big whiteboard I snap a picture of? paintbrush? just text? hmf guess I'll sleep on it.
Yowza! Last night it suddenly occurred to me that the recommended 100ohm resistor on the current-sense is probably too small, since its meant to give 0-5v response over a 6A range, and I'm only using it to around .8A. Since V = IR and its a constant-current output, by increasing the R, the V should go up correspondingly. I threw a 240-ohm on there (all I had) and bingo now have a dynamic range of 10-150 instead of 1-15. Hurray for Ohm's law!
Why do I want more dynamic range? what is dynamic range? Dynamic range is how closely you can measure something over its entire scale. For example a micrometer is very accurate, but can measure distances of what? an inch? It has very little dynamic range. Whereas a tape roll might be able to measure 50 yards, but to the nearest quarter inch at BEST, and that's putting an awful lot of trust into that tape, so it's dynamic range is also pretty poor. Great dynamic range would be a 50-foot wide micrometer. It would also be unusable. One has to have compromises. A dial caliper is an excellent comprise. It can measure to the thousandth over a range of 6 to 12 inches.
The problem with having a current range of 1-15 from "consuming very little" to "stalled" is that 11 is stalled and 10 isn't. But the noise of the circuit might cross that boundary so I'd have to choose 12 as stalled, which means possibly crushing a ballstack. I'll give you an example:
lets say the motor is happily winding along at a reasonable torque, feeding balls and having a jolly time, lets call that current level 5, +/- 1 for noise. When all of a sudden the paintball gun stops firing and the spring starts to wind. the very first current level it will reach would be 6, then 7 when the spring is fully wound and its stalled. Since the error is +/- 1, the controller cannot really tell what's going on, and has to sort of guess.
Now lets say the standard level is 50, +/- 1. As the spring winds it reaches 55, then 60, then 65 and so on until it hits 70 where the motor is stalled. See the difference? Since the signal/noise ratio is cut down (due to increased dynamic range) the controller can probably tell you to within an eighth turn how wound that spring is, and anticipate the stall.
On to the eye. I had planned to determine actual ball-rate, but I don't like that idea anymore, especially since I can meassure the motor current so accurately. , I do need to detect movement as opposed to a static ballstack as opposed to empty tube, though, so lets concentrate on that.
First, as promised, I dragged my whiteboard out and drew some basic state info. Normally, as I said, for a state diagram this simple (fits on one whiteboard) I'd just do it in my head, so this is for the benefit of those following along, sorry about the terrible colors, I increased the contrast so it would show better.

The basic states the Flash board will live in while running the Halo
Quick walkthrough of my thinking-
- When the board is turned on, it enters "Hunting" mode. That's where
the motor is spinning at bare-minimum speed, current and eye is being watched.
If eye is blank, repeat.
- If the eye sees something, the state is immediately moved to "wind
spring". This is a current output chosen to wind the spring 3/4 before
stalling. Stall current is watched for. Once its seen the state moves to Idle
- In idle the only thing watched is the eye, is paint moving?
- If yes, jump to low gear and start watching current. Assign a value that is
"free spinning" and watch the eye, if movement is seen and current
remains at or below "free spinning" then go to next gear. note-
free-spinning will not be entirely free, some torque will be hitting the motor
as the ballstack is stopped/started and the spring takes up the slack. I'd like
to choose a value that would quarter-wind the spring.
- Gears are increased until a gear is found that is above free-spinning but
below stall-warning.
- If at any time the eye stops seeing movement, gear is dropped to low/or
'wind spring'. Haven't decided which would be more logical.
- If at any time the eye stopps seeing paint, this is either out of
paint, jammed, or the gun has seriously outrun us. If current is low, assume the
gun is outrunning us and jump a gear. It could be that paint is bouncing around
inside the hopper, so don't jump to any conclusions, if paint is seen, keep
increasing the gear and watch current carefully.
- If current is high and no paint, it must be jammed, perform auto-unjam
procedure- reverse motor in high-speed for short time, then do a negative hunt
for high torque, timeout of 2 seconds, then go back to Hunt.
That's it in a nutshell. It was top of my head based on all the info I've been gathering, when I go to write it I'm sure stuff will change. As I said before I'm not going to publish the source code for this, but I'll let you know if it turned out more or less like this diagram or I had to make major changes.
But back to the eye. I'm taking black-shelled paint (purple on one side, black on the other) and painting the purple side with a Black Sharpie. I don't know how much IR it reflects, but I'm hoping "not much". Remember, just because something is black in the visible spectrum is no guarantee its not transparent to infra-red. Going to run these by the eye and see how low they respond. Once I get that baseline, I'll be able to pick a value and call it "empty tube".
Once I do that the rest is trivial, all I really care about is if the value is empty, or not empty, and if not empty has it changed recently (indicating movement).
Programming this it occurs to me that I am fast approaching the point where testing individual subsystems won't be possible. I'll have to make up some kind of continuous-feed loop for testing.
Big question. What does "movement" mean? No change in eye level in... how long? This is critical because it will determine how quickly we determine the gun has stopped firing. Well lets see. how fast does "low gear" feed? Guess that'll tell me what I need to know. I'll pick a speed slightly faster than 'low gear' and if the eye stays steady for that long, I'll shift and watch torque/current. If it keeps going up I'll stop everything entirely, fair enough? That'll be the starting point, never know where it'll end up going from there.
After some experimentation I've decided low-gear is going to be 300/2500 as a good stating point, I tuned the 4 LEDs to show values from >120 >130 >140 and >150 note that the 120 barely flashes when free-running, it reads 130-140-ish while I drag it with my finger (to simulate partial-spring winding due to the gun firing at about this rate) and how it tops out at 150 when actually stalled. I think I'll set the stall value for low gear at around 145, upshift value to be <125 and anything in between will be considered "on target".
The Movie (10 megs)
Actually since the differences will not be ball-to-ball they will be curvature-of-ball I think I'm just going to have to determine it empirically.
First unscientific study- I filled the hopper than ran it for 4 seconds. it fed 47 balls in "low gear", so figure 12bps without any sweat, just stopping when the motor stalls against the wound spring. ez. I'll do the same trial at higher speeds, but first I need to assemble this hopper a bit better.. actually I'm going to hold off on that, and the reason is I just realized something scary. I've been running this with an ideal power supply; 9v all the time. Batteries don't do that. I plugged in the (admittedly near the end of their life) 6-cell AA pack and "low gear" barely moved the motor. *sigh* going to have to sense battery voltage, well since I already have an ADC that's no big deal, but it does mean I'll need a voltage divider, since input voltage is 9v and the ADC can only read up to 5v.
A voltage divider is just a pair of resistors wired end to end from power to ground. At the junction of the two resistors the voltage will be determined by ohms law and Kirchoff's loop rule, which for two identical resistors means the voltage will be divided in half. It doesn't matter what the value of the two resistors are, just the ratio between them. If I wanted to divide by 3, I might choose 100K and 50K since together they are 150K, and the 50K is one third of that total. I'm sorry if you don't follow, its the best I can explain it.
Basically I'm gonna put two 4.7K resistors in series from power to ground, and the voltage where they meet should be 1/2 the total. why 4.7K? because I happen to have them lying around, and they add up to about 10k which is sufficiently small to draw very little current.. how little? V = IR -> (9) = I(9,400) -> solving for I is .00095 or 950 micro-amps. Hmm that's actually kinda high, by itself the circuit pulls like 40micro-amps (plus whatever the voltage regulator draws..) better make that divider higher.. how about a pair of 10ks? 9 = I(20,000) .00045? still too high. what else I got.. Hmf nothing.. well I'll try a couple 500K's tomorrow, 9 micro-amps is more like it. The only problem with the higher-rated components is they tend to drift more, the divider won't be perfect, but it should be good enough.
Two benefits from this, one is a low-battery indicator, two is "digital voltage compensation for any battery condition, to ensure constant feed". Starting to get a feel for the functionality behind the advertising catch phrases? This is how they happen.
Measuring this pack its providing.. 7.9v under load, 7.7v fully stalled. Will have to get some new AA's but I think I'm going to call anything under 7.5v "LOW BATT" and try and compensate for voltages as low as 6. I'll also have to warn against over-voltage conditions. but 6 cells should never actually be very close to 9v under load, probably highest it'll ever see is 8.8v.
In any case time to wire it up and give up an LED channel *sigh*, if only I could use that "input only" pin for something, but the only inputs I have are to the ADC, and that MCLR pin can't even be an analog channel! Bah what good is it.
Built. Now figure 0-5 v would be 0-255 so that's 50 per volt, but I just divided it in half so 25 per volt.. *tinker* confirmed, probably 25.1 per volt or something but *shrug* close enough. Now I'll find what curve I can draw through the voltages by finding (empirically) "first gear" for 7v, 8v and 9v. With any luck it will be linear so I can just run everything through an interpolation function rather than resorting to lookup tables, but I doubt it, this doesn't feel like a linear response circuit.
Rats its not, oh well I suspected it wouldn't be. at 7v first gear is 1800, at 8v its 2250, and at 9v its 2500. Time to get 6 AAs and see what the discharge curve looks like. I'll probably pick 4 or maybe 5 key points and make a lookup table for them, then depending on what voltage the pack is at, different constants will be chosen to maintain consistent performance.
Now if I'm really living right, then the stall/loaded currents for the gears will be the same so I won't have to tune them too. everyone cross your fingers.
Up until now I've been programming with the assumption that this chip will have plenty of room for everything, but it looks like I might be needing to do some 16-bit division (or something that will LOOK like 16-bit division) and that's going to eat up space fast, we'll see, just an aside really. I can always go to a PIC with more program memory.
Time to iron out the eyes today, pulling out the trusty millimeter because...? As every Electronics Professor will drill into your head, an Oscilloscope is not a voltmeter. Although you can fake it with one, when you need to actually measure voltage, right tool for the right job, and I need to measure eye voltages precicely.
Voltage at rest (tube empty) - .140v
BLACK SHELL
peak (highest I could get it to read) - 1.14v
trough (voltage between two black-shelled paintballs) - .147v
GREEN SHELL (and hopefuly representative of 'normal'
paint)
peak - 3.11v
trough - 1.58v
I had to really jockey the black paintballs to get that low reading, they have to be in just the right place.
Well that explains a few things, yes? 1.14v is not enough to trigger a CMOS logic level, but my ADC will see it just dandy. Your paint-sensing problems have come to an end. No need for microphones. Now lets do some math and figure out some ADC values. Actually this claims to be a 10-bit ADC but read_adc() call only seems to get 8 bits. where are those two missing bits? I'm going to guess they are less significant than the other 8, and probably too noisy to use reliably so I'm not going to worry about them unless I have to. I bet there is a secondary call you can make to get them but *shrug* I'll look it up if I need to.
Given 0 = 0v and 255 = 5v a simple calculation yields .0196v steps. Okay this is easy, .140 / .0196 is 7.14, must take the cieling so 8, 8 x .0196 puts our "empty" level at .1568v right? You think thats a good idea? raise your hands if you think thats a good value.
Now get your hands down! Think! Don't just read along. With a difference of a single tick between "empty tube" and "paint flowing" what do you think will happen? Maybe for this particular Halo, at this temperature, with these ambioent light conditions with a perfect voltage supply that will work. But I guarantee it won't for a lot of others. I have to choose robust values that will work for any halo anywhere under any conditions.
So. what would you do? Take a moment to think about it if you'd like, all the information is there, I'm not going to pull a fast one and tell you something that I haven't already written. If you were me, how would you tune the eye?

WWCD
*ponder* -- This is what I'm thinking:
The absolute worst thing that could happen is if the HALO thinks there is paint in the tube when there isn't. It'll sit there waiting for you to fire your gun, thinking its staring at a ballstack, and never turn on, so I have no choice but to set the empty-tube detection threshold at some sane value like, say .4v (which is a bit too low for my taste) to account for manufacturing tolerances, clear hoppers, differences in eye components or mounting angles.. you name it. I think .4v is low enough that any paintball will trigger it, but high enough that it won't think there is paint when there isn't. I might even be talked into .3v, except that there is something else to consider.
Realize that the distance above the bolt is not constant, remember I realized that earlier? But the diameter of a paintball is. So if two paintballs stop at just the right place, they will always stop at just the right place on that particular gun. Some players have figured this out and change the height of the hopper until a 'sweet spot' is found, but I bet a lot don't know to do that, and frankly shouldn't have to.
Point being that it won't be an unusual case, when it happens to a gun, it'll happen all the time. Can I use that?
I think so. What's the failure mode? Halo is feeding, HAS seen a paintball (even dark-shelled paint reads high enough most of the time to be detected with a lower-threshold of .4v) then all of a sudden paint dissapears. Halo shifts to low-gear, and the motor torque climbs, even though no paint is in the tube. We all know what that means, right? Correct! Its jammed! :)
So it thinks it's jammed when it isn't, and performs the motor-reversal unjam procedure, but when it forwards the motor again the same thing happens. no paint, but torque increases. Assuming the gun is not fired while this is going on, the HALO must then come to a conclusion which is? Its feeding invisible paint.
So what to do about it? Brainstorming-
- I can actively tune the 'empty' threshold, lowering it until
something is seen, but then what if the Halo really is jammed?
- I can require the HALO be empty when its turned on, so the 'empty' threshold
can be measured directly. I can even store the value in FLASH for later use. Of
course what happens when the board is taken out of one Halo and put into
another?
- I can do nothing at all, since the motor is under spring load, when the gun
fires, balls will be forced down the tube and motion will be detected.
I think I'll choose option #3. What this means is that jam detection might be a bit dicey. If motion stops on an empty tube and current stats going up on the drive motor, it will look absolutely the same whether its a legitimate jam or dark-shelled paint in a gun that just stopped firing. Is there a way I can logically figure out which it is?
yup. Whats the peak? Dark-Shelled paint peaks out at a measly 1.14v! Its not too useful to try and find the trough, but keeping a running tally of the highest value seen is surely of use. If its less than, say, 1.5v then on the second unjamming routine it will assume the gun is not jammed, just in an awkward place, and wait for it to fire.
This has two problems:
- If the hopper really IS jamming with dark-shelled paint
- If the hopper is loaded with two kinds of paint, but more likely with paint
that is dark on one side and light on the other, showing a very healthy peak.
I think that second case is likely enough that it bears some ponder time.
*ponder*
I don't know that I have a good solution for this. I can't very well say "works with dark-shelled paint" and have it not. That only has to happen once. Hmmmm... would unclearing the jam give me a clue? No that'll look pretty much the same weather its a legitimate jam or not.
Hmm.. wait a minute.. there is a difference! order of events! If the loader is jammed, the current will go up with balls still in the tube, followed shortly after by balls disappearing. but in the case of dark-shelled paint, the stoppage will be seen, then the current will rise on the motor as the spring is being wound.
Okay thats what I'm going to implement, and we'll see how it turns out, I just happen to have some dark/light shelled paint here to test with.
If you have a better solution, please do not tell me what it is. It would be awkward since I'd be selling your idea instead of mine, and I wouldn't even want to use it unless I could reasonably say I would have come up with it eventually.
Speaking of contributions, however, the name CHEETAH was suggested to me for this board. I like it, and the suggestion came from non other than Doc Nickel himself.
Problem. I have been doing some current-draw and voltage-level trials and discovered something rather annoying. The spring is not strong enough to move the drive cone when the hopper is more than half full. I can send the drive motor enough power to just barely wind the spring to full (which I thought was ideal) which it does, and then sits there.
That means that I will have to intentionally overdrive the cone spring to feed balls, and that a jam will look just like a partially full hopper. I plugged in the original board and its pretty brutal, I see why it smashes balls. I think I can do a better job but Its not going to be perfect. What I'm thinking is that I'll find some happy medium to drive the cone at, and if it halts for too long I'll call it a jam. Since my use of the eye is going to be a lot better than stock I think it will still be a good improvement.
When I get near the end of this project I'll probably figure out what "smash ball" current level is by wedging one in there, but I don't want to clean it up so I'll hold off on that trial. What I'm going to do now is figure out the un-jam sequence.
Alright while I was at it I "big-banged" the rest of the code in. Put in all the basic states and mechanisms. Plugged it in, turned it on and blammo it didn't work. Well kind of. The up-shift algorithm did work and boy-howdy! when it sensed there was nothing under it but empty space it kicked the hopper into high gear and the paint did fly! Of course the motion-detection is busted so even when I stalled it it upshifted but hey, can't have everything :)
Now comes the fun debug process.
Session 15 PS:
I know I said I wouldn't post anymore code but something occurred to me. This is the first version of the "full" code. It does not have everything I'm planning, but most of it, and its broken. Its close to working but needs many fine tuning and adjustments. In addition most of the magic-numbers are just placeholders and not correct. Ever wonder what the KM2 code looks like for guns and such? it looks a lot like this. I want to stress that this program is barely halfway complete, it compiles but doesn't do the job yet. A large portion of it is still test-bed type stuff, where I'm just wiggling subsystems to make sure they work right before being woven into the final product.
Okay first things first. I was hoping to get lucky with my motion/empty algorithm but didn't, so I'm going to turn the motor off and work the ballstack manually. L1 for "motion" and L2 for "empty" massage the algorithm until they come on at the right time.. *tinker*
Okay there we go, but motion detection is far too sensitive, if I shake the hopper (to simulate someone walking/running) it fires off. need to de-tune it. 'Empty' threshold at .392 is too high for this black paint. trying lower.
Hmf. These two markie-darkened paintballs are giving my algorithm fits. I think I'll make this baord self-calibrating. The default value will be 20, but if you hold the on-switch for, say, 10 seconds, it will assume there is no paint in the tube and read a new empty value, add .1v to it and that's "empty".
I received a suggestion in my email to do this, despite my warning not to, and the reason I asked not to was because I was considering this, but you may find it hard to believe since I'm implementing more or less exactly what you suggested. *shrug* I'm sorry if you don't believe it, but I offer as evidence that holding the on-switch (or trigger) for more than 10 seconds has been my standard method of factory-reset since the Glacier board 4 years ago.
Unjam sequence is cool :) but with the power to turn the motor on full blast comes the power to smash balls to a drippy pulp. I've been using my finger to simulate drag/jams as I debug. Its getting bruised, but it beats 5 minutes of cleaning after each trial.
It has been suggested that it seems like I'm on a sugar high? That of course is absurd, my drug of choice is caffeine and I take it in bladder-busting quantities. This is not a gag photo, I go through three or four of these a day of either Ice Tea or Diet Coke.

Found out today that "maximum impedance for rated accuracy" really means "maximum impedance to read anything at all". I wired up a pair of 450K resistors for the voltage divider and the ADC flat lined. I promised myself I wouldn't do this but I'm gonna give you the theory on this.
The ADC on this PIC chip is a sample-and-hold type. This means when its engaged a capacitor is connected to the ADC channel for some setup time (the sample). It is then turned off (the hold) and drained into a series of resistors. Depending on which resistors it triggers, the voltage is quantized into 'n' levels, representing the number of bits in your sample. I know thats not clear, if you really want to learn more, google it :)
Since 450K resistors high impedance (impedance is the complex AC version of resistance, resistors are the only component that have the same impedance as they do resistance, capacitors are 90 degrees out of phase with the real plane, coils are 270 degrees out of phase. its some badass math I'm not going to go into because frankly I don't fully understand) Their impedance is so high that they can't charge the hold capacitor in any reasonable time, so the ADC thinks the voltage is 0.
Upshot is I have to use a voltage divider with less impedance, for now I'm using a pair of 4.7K. I will probably have to switch this with a cheap N-Channel MOSFET so the circuit does not drain the batteries when "off"
Let the bugs begin! With whip and chair I'm beating them back, but I'm pretty confident in the actual hardware, so for a change of pace I'm going to start laying down some board design.
Segue-
I've gotten a lot of email with very similar subjects and requests; how do I learn to do what you are doing? Not to sound zen.. but.. do it! 90% of my practical knowledge has been through trial and error. When something doesn't work, don't bang it with a hammer until it does, figure it out! Learn something! You never know what it might lead to.
Get the book knowledge, you'll need it, but realize its just a beginning. I know its cliché but its true- don't just learn stuff, apply it! If you numb your ass in a classroom and do nothing more, you'll make a great chief of police, but you won't be nailing badguys in the mouth while holding a baby carriage* The only way you're going to understand how to use an OpAmp is not with mind-bending otherworldly imaginary math, its by throwing one on a breadboard and hooking it up to a mic to record your own heartbeat, just for the hell of it. You need the math, but really you just need to know it exists, in the real world unless you are doing research or teaching.. triple integrals just don't come up, and figuring out the Eigenvalues of a BVP? Not a lot of practical use.
Most college professors won't tell you this, and I think its because most just don't know (its easy to forget when you spend all your time in a university environment) but if you don't get into a lab and make some smoke, you're not going to be doing much. Implement the Betty-Crocker bridge rectifier, but don't sit around all day computing voltage drops and electron density for chrissake, figure out how to run a stepper motor with it! Play with a thermocouple and make a drink cooler. USE what you are learning.
Bottom line- I guarantee you will learn more about how to actually do this stuff by to making an LED blink 'hello world' in Morse code on a circuit you build and program from scratch than in all your circuit-design classes combined.
*its obscure, either you know it or you don't.
End Segue
Now where was I before I got on the soapbox? oh yeah. damn circuit keeps detecting motion when the motor reverses.. bet its the current spike.. better move the eye sample loop under the motor current spike dampener routine...
Bah. been away too long. Doing what? A lot of dayjob, and the 5.0 code for Bob. Its fully debugged now, but he's the marketing man so I'm not going to say anything more than its ready and I already know of a few teams using it. The way that code handles firing events is now so crisp it almost anticipates the trigger pull for you, but I don't want to give away too much about it, the competition is kinda tight for trade secrets on firmware revisions.
Saw a post on the Tinker board the other day about freeware firmware for paintball boards? I have mixed feelings. I will say "its harder than you think" to write real cutting-edge code, it takes lots of field testing and figuring out what works and what doesn't, and there is plenty that doesn't. I've been down dozens of garden paths on eye logic. The one I have now is.. well I wish I could talk about the solution because its really cool, but obviously can't.
I will also say that such an effort is doomed if attempted in assembly code, unless its written by one crack programmer. I know it seems easy, but after you've added all the features in.. it just isn't.
Back to the Halo, I had a sudden thought! DUH! Why measure voltage and current and then try and use the values independanty to determine stall current. What I really want is stall power. y'know what the equation for power is?
P = VC
Power is voltage times current. So multiply them together, figure out the magic power number, and be done with it *smack* okay implementing that.. Hmm gonna be hard to zero those numbers empirically without an uplink.. this might be what pushes me over the edge to build one.
Looks like it works. I making some real progress here. In fact.. want to see? In a head-to-head matchup my prototype Cheetah board against the stock board. Here is the video.
How many balls in the tube? 138 (I counted) which means the stock board is feeding 21bps, the Cheetah? 30bps. Right in front of your very eyes. Actually the cheetah feeds quite a bit faster than that, but this is the fastest it can go safely. You should see it go with the safety features removed.
Took it to Ultimate Paintball today. Against my better judgment. The movie industry has everyone convinced that "prototype" means "amazing kick-butt action". In real life, prototype means buggy and fragile. However Bob was going to be out there today and everyone wanted to see how the project was coming, so I buttoned it up, burned the code I was most happy with, and headed out.

Franken-Halo.
It performed flawlessly. To say it went over big would be a huge understatement. When asked "so what's this do that the stock board doesn't?" I would say "It can unjam itself, ramps the motor speed to your rate of fire, and sees dark/clear paint" The proof was in my hand, and I had many people pass this halo around before they believed me.
I actually had 2 people offer to buy this from me right there. Someone had a bag of that Wal-Mart wildfire or some such "clear" paint and said "can it see this? my halo can't" I had no clue so I said, "Probably, dump a handful in there" he did, the motor whirred for a second and loaded them just like it was supposed to, stopped on a dime. All he wanted to know was the price.
Which I honestly don't know. That gold chip is expensive and to have them done in time.. I just don't know. But I'm going to find out. Bob wants 100 as fast as I can make them for demo/giveaway/presales in Chicago and I am going to accommodate that. So if you want to see the prototype, be there :)
So first field test was successful, it was put on a few guns and blew paint out as fast as they could cycle, frankly I was on pins and needles the whole time hoping nothing would break or overdrive. This circuit has the power to crush those balls if it chooses to.
At this point I am taking a quick mental survey.. how much have I done and not written down here. There are a few things. Nothing I've kept secret per se, but stuff that would be needlessly trivial, like the microswtich on the left side of the board, I threw it on there so I'd have an on/off input. I'm planning to use a 10k/10k voltage divider circuit because things are noisy and I need as little input impedance as possible, but I'm also going to put an N-channel MOSFET on the bottom side of that so the battery circuit can be de-energized to save power.
The code? Its changed substantially from that last snapshot I gave you. I discovered some things and had to do some fancy tricks to get it to work right and I think at this point I've done enough proprietary that I'd rather not give out the source. its pretty close to release-candidate. Having said that, all the information I used to write that code is here, so I don't feel I've violated the spirit of this blog. The eye-logic in particular I don't want to talk about except to say its a hybrid of all the concepts I've discussed.
Now on to more business. Time to actually lay down copper. I have to have the Gerber files to my board house by Monday and that means a long weekend. My process for this is pretty simple- first draw a circuit up, check and re-check, then lay down the components and route. So step one, draw the circuit. I prefer Engineering paper for this but don't know where I left mine.. oh well..
*compose*
Okay here it is, this is the circuit seen above in that board.

Clean schematics are the sign of a sick mind
Next is to lay down the copper for each of the components, there are only 3 critical location (aside from the dimensions of the board) the two 4-pin headers and the power toggle. everything else is "eh.. how about.. here?" type stuff, based loosely on my schematic and anticipation of routing.
The proper way to do this is compose the schematic in a schematic editor and then lay down the library components, define keep-out zones and then fire off the auto-router. Why don't I do that? Because I don't know how to use the auto-router/schematic editor and gamble it would take me longer to learn than to just do it manually. That was it to start with, but I think its time I learned.

Basic component layout
There we are. Basic component layout. the copper and the stop mask. Don't know about the heat sink on the H-Bridge, maybe it doesn't need any at all and maybe that's not enough, but my bet is that it doesn't need any at all, I'm only using 1/8th its capacity under intermittent conditions.
Time to mow the lawn again before I lose the light. Might be back later or might go to a friends house to inspect a hard drive, probably the latter, I'll gnosh some dinner while I'm at it and do the routing on this tonight. Tomorrow is slated for Angel board.
Back.. Alright going to need more capacitors on this board than I normally have, time to do some spelunking. oof.. need some big ones to soften the massive electrical shocks this board will be seeing. how about 220uF across the +V inputs, 47uF across the +5 and might as well make those electrolytic.
BAHAHAHA.
OMG .. okay so I'm trying to find the cheapest one I can since it doesn't matter for power-spike suppression, and I run across these super-cheapo's. Notice anything about them? They are exactly the same ones used on the stock board. I almost can't use them for just that reason, but what the heck, let people wonder what component we had in common.
Which is just part of the real fun, specifying the BOM (Bill Of Materials) for the board. This is the file handed to the board house along with the design that tells them exactly what parts are going on it. Down to the last letter it must be perfect. one of the many details that I sweat. an example excerpt from the BOM I am creating for this board:
|
PIC 16F676 |
U1 |
PIC16F676-I/SL-ND |
|
H-Bridge |
U2 |
MC33887DH-ND |
|
47uF electro cap |
C1 |
PCE3001TR-ND |
|
100uF electro cap |
C2 |
PCE3295CT-ND |
Note that I generally use Digi-Key part numbers, thats because Digi-Key has a stellar online search engine and I can pinpoint the part I want. My board house sometimes sources from there but not always, they will shop around and get the cheapest price. They are also allowed to substitute parts as they see fit, to a certain extent. A Panasonic tantalum capacitor could be swapped for a Zetex, for example, but they would never change tantalum to ceramic, or electrolytic, since that might be crucial to the design.
The rest of the stuff is filled in now, now its time to route it.

Coming together
How do I route it? Same way I built it, a wire at a time. This way I can double-check the design as I go. Oh I had an inspiration, under the H-Bridge? gonna make that a cutout, that way you'll see the gold heatsink through the bottom of the board. Should give it a high-tech feel.
Just as a side-note. I predict that despite my efforts here, I will be accused of hyping this board, and claiming it can do things with "no proof". Mark my words.
*route*
That wasn't so bad. Plenty of area to work with:

See my mistakes? I guarantee there are some
Its been my experience that its impossible to debug a design like this in one sitting. Now that its routed, I'm going to put it aside and work on a different project, then come back to it and check it. I'll check it at least 5 more times from first to last before sending it off for fabrication.
Already figured out the first error. See it? or rather.. don't see it? How do you program this thing? GRRR have to add a programming plug, and those IC routs are already cramped enough. razzin frazzin..(*&^(*&.
Before you read further, if you had to place a 5-pin programming interface onto that board.. where would you put it?
Me? I layed that sucker smack down in the middle.

Eat my shorts, H3
Okay I'm done for the "day" (its 4:37AM) I'm hitting the sack. will double-check this circuit tomorrow.
What I'm going to do is just list the highlights of the errors I'm finding in my first check of the routes.
- Ground was not connected to the left half of the board.
- No reason to go hog-wild with the copper on the common pins on the H-Bridge,
will just make soldering harder. backed that off a bit
- C4's wire is crooked, no big deal but looks unclean
- VR is wired correctly, but pin one is called out in the lower right, needs to
be the upper left. That would not have been fun.
- VR miswired, on/off can't be wired to the output, duh the output is off
until the on tells it to be on.
- Swapped power and ground on the PIC. No picnic there either.
- I don't like routing that ground wire so close to the cutout, moved some
traces around so that won't happen
- DUH +v runs right by the programming interface, don't need a via and layer
change to get to it.
That about does it. Will go over it again a few more times, but sending it out for quote right now *click*
WebLog-readers special (I will not announce this anywhere but this paragraph, to ensure only people who actually read the blog can enter) : I'm going to need 5 field testers. You will receive a Cheetah for free, in return for agreeing to try it out and write an honest appraisal/review of it. This is feedback so I can figure out what's wrong with it and what needs improvement. Good or bad you keep it (I'll reflash it with the code updates from your feedback of course). I will also publish your commentaries here, and include any pictures you add. First 5 emails I get with addresses are the winners, set the subject line something recognizable like "Cheetah Contest"
Contest is over. Thank you for participating. The winners are (in chronological order)
Timberwolf
Tim
Josh Coray
John Smith
Ryan Shanks (last entry reached me about 7 hours after the contest was posted, I have recieved over 30 since then, I am honestly flattered and amazed, thank you)
There is no way I'm going to remember your addresses or names other than putting them here, so when I give the word (and please not before, the email will just get buried) I'll ask you to email me your physical address.
The Halo went out today for fabrication, boards are on a one-week turnaround, I expect to have a populated panel in hand next Wednesday (do not expect much to happen blog-wise until then) Depending on how well or poorly testing of rev-A goes, I would expect you to have the prototypes in hand for that weekend, to never :)
As an aside, I want you to know how much of a risk this is for me. Public beta tests of things like this can be good or bad. Like I said above, Hollywood has you/us all convinced that "Prototype" means 10x better. It doesn't. Please try and internalize this- the Cheetah board will look cool, but thats all I can promise. It may have a bug in the unjam code (which runs the motor at FULL SPEED for a brief time to unwind the spring) and smash your hopper full of paint. It may crush a ball stack. It may do nothing at all.
The first dozen or so version of the software couldn't even start feeding paint reliably! you would fill the hopper, and it would go *buzzzz* and never torque the cone enough to start the ball flow. There are all manner of bugs that will happen with this beta that the public is just not used to seeing. Please be prepared for it
Its a gamble I'm willing to take.
So. It came back from fab and here she is:

I put a message there to my fiancé "4QT" (for cutie) and thought it would be a great gesture. She agreed but it didn't last. After she saw it in the loader her comment was "*hmf* can't see it". Ah well :)
So to business. I got back home at 1am and have work tomorrow but I'm too excited to wait, going to do some basic checkout right now. First the programming interface. Oh hell I got the spacing wrong! I did 2mm spacing! the JST is less than that.. crap crap crap crap
well I'll jam it in for now, and re-spec 2mm breakaway header for it and a different programming interface. no real harm done there. Program some basic 'wiggle' code. First the I/O map and pin definitions.. okay.. next up lets see if the lights work
yup. RGB all fire. Motor control? forward and backward check. On/Off switch? yeah that works but.. awww crap.. no way to turn off the /MCLR pin, that pull-up is going to live in the on position sucking power. )(*$&*()$#$. But its the only input on the board that isn't analog. Guess I'll try a super-weak pull-up and see if it still works. actually a pull-down, I reversed the interrupt logic so it doesn't wake from sleep properly. Speaking of which how much current does it consume asleep, better be micro..
6.4mA !? WTF. Everything checks out.. but it should be drawing 1/100th of that. This could be bad. must find where the power is being drained to. Well between soldering the programming interface and the test program 3 hours somehow elapsed and its 4am. got to be up for work at 8:30am. sleep now. more later
Let the analysis begin.
There are just too many variables now, and the only way I'm going to be able to analyze it is with a serial interface. I threw together a serial level-converter based on the MAXIM MAX202 single-supply converter. Love this chip. throw some capacitors at it and it has built-in voltage pumps to convert the TTL 0-5v to +/-15v RS-232.

I know what you're thinking.. why don't I have one of these lying around?
I've built and given away more than I can count.
Programmed the board for serial output and just send out the data over the programming cable. hmmm.. should I leave this in for other enterprising people to read the telemetry off? Sorry can't, the RS-232 PIC driver takes up way too much space.
So what do I want to know?
- I guess it would be cool to see exact eye readings
- I want to know the battery voltage when the H-bridge is on and off
- I want to know the current draw when the H-bridge is on
The normal operations will be easy, turning the motor on and watching the paint go by is easy. There are three cases that require attention, and I need this data to identify them, in all cases the eye is registering "nothing", since if the eye is registering "something" we can rely upon it to tell us what to do.
case #1 is when there is a "partial" jam. That means
the paint is jammed, but just kicking the voltage higher for a sec will unjam
it, this is typical of startup, a full hopper with the top squished down will
stall the motor, but overdriving the cone spring fixes it.
case #2 is when it really is jammed, and turning the current up will just
skwoosh the paintball.
case #3 is when the paint is invisible to the eye (exactly between dark/clear
balls) and turning the current up will skwoosh the whole ball stack.
Yuck.
And it gets better. Currents/voltages change over the life of a battery. I have here 6 nearly dead cells and 6 fresh cells. Using identical duty-cycles I get wildly different data, so the trick will be finding the magic formula that identifies the above three cases. I'm going to do this analysis with Excel and data dumps. My method of analysis will be to very the duty cycle from wide-open to motor-not-driving and then stall it with my finger and mark the position where the stall occurred in the data, and try and find the formula that identifies it. I'll just save as aI go and post the raw xls when I'm done. I could attempt to annotate it but I'm not going to, I just don't have the time, so you're on your own. I'll be including some graphs though, so it might be worth taking a look.
My first thought is to multiply on/off battery differential by the current draw squared to determine a stall, this formula predicts stalls nicely, but how to normalize the peaks? grmph. Looks like a case where I just need to gather data and stare at it long enough for the patterns to emerge. I really wish my process was more scientific than that but its not. I will stare at the column of numbers and try relational formulas until I get an equation that predicts/describes a motor stall.
columns explanation:
gear- what "gear" the hopper is running in, represents the off-time
duty cycle, so 0 is full-bore
delta- difference between the battery voltage when the motor is on and off,
keeping in mind its switched about a thousand times per second
Batt On- A/D output from battery detector when motor off
Batt Off- likewise but fo when the motor is switched on.
power on- current x battery ON voltage
power off- current x battery OFF voltage
current- current draw (output of A/D)
eye- output from eye A/D (with nothing in the breech its pretty small)
Alright for fresh cells stall detection is pretty trivial, but for drained cells.. can't be done. I think I'm going to decide how much pressure it takes to smash a paintball and then call that stalled, and if drained cells can't exert that much energy then who cares about stall detection? I will also setup a timer. If no paint is seen after a certain time, the motor will reverse itself as if there was a stall/jam weather it detects one or not. I think that's about the best I can do here.
VERY interesting. As the duty-cycle goes up, the current consumption actually goes up too. That makes sense, its an inductive load, switching it on takes more current than just running it (coils resist changes in current, capacitors resist changes in voltage).
Hmm.. has a slope of about 1/3 a HA! Check out THIS graph- {(delta * current) - gear} vs {stall} (constant data points at 10000) I think I can safely now predict when a stall is going to happen with fresh cells, how well does that track with crap-cells? not well. But as I've already said.. at that point who cares. lets program an algorithm that takes advantage of this data and see how well it tracks through different voltage supplies.
*revelation?*
You know, I might be going about this the wrong way. What if I came at it backward? Rather than setting the duty cycle and then watching the feedback, what if I turned it into a sliding-mode feed-forward control system and modulated the duty-cycle to meet the feed rate I want. If I did that right, stalls would not happen since the motor would slow down as it was approached.
HMM. *program*
That might work, but I think I realized something that makes it moot. I can make the high-gear sensitivity super-high since if it detects any kind of blockage it can instantly drop to low gear with no fear of interrupting feeding, since at low gear the spring will only just be wound, we have time to let things "settle" and see if there really is a jam, or it was just a false alarm.
In fact, if motion is slowed or stopped for any reason, the gear will instantly drop to "wind spring" level for half a second anyway, so its probably moot, but I am paranoid about breaking paint, and I'm sure the players will appreciate that.
Fiddled with some stuff and couldn't get the board to consume little enough current. finally figured out what I was doing wrong, the programming interface was still plugged in, and evidently it draws power! With it disconnected, the board draws around 300 micro-amps (.0003A) when off, which is still a bit much, but lessee.. figure Alkaline AA cells for what? 1000mAh? Not like Duracell would publish it. that means that the board would stay alive for 1/.0003 = 3333 hours or around 4 months. Thats still way to high, but assuming the kind of person who buys this board is the same kind of person to play reasonably often I think its reasonable to assume the sleep current is a sufficiently small part of its overall duty.
Speaking of reading the data sheets from cover to cover.. I seem to recall a "free wheel" setting on the H-Bridge. I wonder if I set it to free-wheel on the off cycle the current will look any different?
*WOW*
OMG this is it! Stall sense is now trivial! No math needed. Just need to watch the off level current. Apparently in "Free wheel:" the motor will feedback like a generator, right? that generates current! so if the motor is stalled, there is no current generated in the "off" position. Aww rats it only works at low duty-cycles. Well thats not so terrible, it means if the eye sensor loses track of the paint then I can instantly drop to a gear where this works and sense a stall more or less directly.
What I've decided I'm worried about is pretty simple- actual jams while in high gear. I think I'll have to accept that its just impossible to sense them fast enough to not crush the paintball. its not that it can't be done, it can, but battery condition is too much an unpredictable factor.. is the motor stalled or are the batteries just hot? Okay time for bed, I'll sleep on it.
Big day tomorrow (Saturday) Bob has several Halo's in for demo purposes and I'll be bringing them to Ultimate.
So the stock drive cone snapped in testing today. Tab popped off. I guess this is a common problem? yick. Stopped into Georgia Paintball and picked up a delrin drive cone, it has a re-enforced pin-thingy but now I'm worried about the stock shell. So how do you put this thing together?!

Always so easy to take apart..
I can't seem to prewind the spring and fit it into the sump. After 10 minutes of fiddling I guess you're supposed to put the thing on the top and wind it to the tab, catching the spring, then lift it slightly to pass over it and pre-load it. Anyways that's what I did and it worked so I'm back in business.

That wasn't such a chore now was it?
Oh fiddlesticks, I have to mow the lawn before I lose the light, I've put it off for over a week now and I think the lawn has a pretty good fighting change to mow my tractor at this point. Be back in an hour.
Okay lawn is mowed.
.
.
.
After fiddling around with this thing for basically 9 hours, I think I finally have a software version I'm willing to call a release candidate. Blue is "loaded" Green is "firing" purple is "don't see paint" and red is "jammed". I don't know how fast this is firing, I set the morlock for 30bps but it doesn't feel that fast, if I had to guess I'd say 22. I know it can go faster, here is the video:
PS- my 5 beta-testers, please send me your addresses now, I'll have these in the mail to you on Monday, after the field trial tomorrow and whatever refinements it calls for.
Well they were a hit. a BIG hit. It went down more-or-less like this:
- I arrived at the field and met Bob, I handed him the box and set up my
laptop/programmer expecting to test one or two halos with some guinea pigs.
- Within second a crowd had gathered (everyone seems to have heard of these
boards) and ask to see/test them. I pass around my prototype and let people
stick their fingers in it to see it reverse itself and unjam.
- Bob and I decide to install some in loaders for people to test, I installed
three. Two worked perfectly, the third seemed to have an over-sensitive eye. It
seemed to think there was paint in there when there wasn't, exactly the case I
discussed as being the worst possible. Luckily the stock code winds the spring
up even if it senses paint, and it would still load itself, and since the eye is
differential instead of absolute, it still worked perfectly since it could see
paint flowing by the eye and detect motion. [PS- I figured out this issue and it
led to a new feature..]
- They are used in the field, passed around, and there is much talk, all hugely
positive, the performance was great, and they worked exactly like they were
supposed to work- invisible, the paint just flows.
Only negative was people noticing the hoppers slowing down as the batteries became drained (they were used a LOT) My bad, I forgot to upshift "low gear" as the voltage goes down, quick fix to the code and it was transparent again.
When Bob got back to his shop there were people there waiting for him to return, to get them.
The timetable on testing of these boards was moved up the past few days. We had no choice, so instead of sleep I have spent the last week testing this code. I have put easily 100 hoppers of paint through it observing and refining. Release 1.00 of the code is now ready and Bob is shipping. Remember these boards have lifetime warrantee of hardware and software, free upgrades, the works.
Upshot is, for the people who signed in in time for the "cheetah beta" you still get your boards and I still expect reviews/pics. It was never about getting them first, it was about getting them soon and being part of this blog. Please send your addresses in to me! I do not have them, I know you already did, that they were part of your original emails but I get hundreds of emails a day.
So that's it. From "wouldn't this be a cool product" to product shipping, you've seen it all. I hope you've enjoyed the ride, I know I sure have. But this is only the beginning, I'll make 50 teeny refinements to the code in the next 6 months, adding features and integrating new ideas and information learned in the field. No product like this is ever "done". There is a saying when I worked at NASA- "kill the engineers, its time to ship"; I was one of the first ones up against the wall.
If you have any questions, as always I'll try to answer them, my email is right up there. In parting here is a final drop test illustrating 30bps, and its in MPEG format: Fast enough For you?
Oh, and I've started a collection.. seems the people I'm swapping them out for don't want them back after they play..

Hey buddy, wanna buy a v35 board?
Thank you for your time, I'm calling it a day.

SNNXXzzzzz........
I just got back from the FedEx drop box where I stuffed 10 or so boxes into the thing. (what, you think the 5 beta testers are the only ones getting eval Cheetahs? :) Most of the packages were sent overnight, so you'll be getting them tomorrow (Thursday). If you want your feedback posted here I will do so, with pics and everything, verbatim and un-edited. If you want to remain anonymous that's fine, and if you just want to send me email and not have it posted simply say so.
Yes, you get to keep the boards, I think I already mentioned that.
Hello, I've received the board and have done some nice testing with it.
I made a plexiglass cover for the stock board...looks great with the new one
So...the hopper feeds a consistent 17-bps with the victory board (on the highest setting). As noticeable in these videos....
Put in the Cheetah and instantly increased the speed between 19 to 19.5-bps.
So that's a good increase in BPS right there. I love all the different features of the boards, the varied gears, anti-jam, fact that it doesn't continue to feed when empty...much preferable to the stock (as would be expected).
Regarding that transparent paint I told you about earlier....the board seems to work okay with it. While obviously non-functional with a standard reflective eye pair, the ones in the Halo can see it with this board. I found out that the paint was cheap crap that is made for retail by walmart and other such stores. If I had to guess (without knowing about the electronics firmware) I'd guess the eyes sensing even the slightest movement is only what matters.
-from Andrew "Ydna" DuBuc
ZDS Paintball - zdspb.com
Okay after a less than successful first test, i sent my board off to get the eye logic reprogrammed.. (thank you)
and now i can honestly say, there is no board that can hold anything to this one..
I did my first run of feeding the balls via the standard drop test.. there was a little "push through" tension on the stack which is just like any other halo
I've ever dealt with, which is a good thing. the eyes no longer have any difficulty reading or seeing
paint, and as always when the loader ramps up to overdrive its very cool
okay, now for the on gun.. as you may recall i became aware of a small problem with the eye logic, and that was it has some issues with seeing paint in a no-pro style feedneck from CCM, after the reprogramming that issue is gone completely, i fired off a quick semi only burst,, no feeding issues, no eyes issues, no motor issues, so now i decide to give it a little run, my predator DM5 board is set to 28 CPS and turned full auto on, and gave the board a run for its money, i now notice that the ramp up for the motor is alot less pronounced in the old one, the motor would ramp up from about 15 up to 20+ and then to overdrive, this time i
couldn't even sense it starting to shoot slow and going faster, it was one speed FAST, i shot off about 100 or so rounds in less than 6 seconds, i
wasn't counting or timing, but that sounds about right
as i write this i realize how hard it is to rate a product on how little you notice its there, and i have to say, i
don't notice this board at all, it feeds like it should and it unjams like it should. a very fine product that does all its intended to do
Tracker