Close

NeuroBytes v0.9 tested, programmed, and revised...

A project log for NeuroBytes

Build your own nervous system!

zakqwyzakqwy 06/02/2016 at 16:470 Comments

I spent the last few days building a bunch of NeuroBytes v0.9 boards. I also received my order of pogo pins in the mail, so I built the tester/programmer:

Problem One: The pogo pin on the far right side doesn't fit between the two axon connectors, so I had to remove it (hence the solder blob in the picture above). You can see how close it is on the PCB layout here:

Top arrow points to the light pink outline of the JST header; bottom arrow points to the AXON2-SIG test pad. The distance between the two is a scant 0.3 mm, which is not enough room for the shoulder of the pogo pin to clear; the tip never makes contact. Not a huge deal for programming since AXON2-SIG isn't shared with one of the ISP pins, but still something that needs to be revised.

I modified the LED test program to use the new port designations; these tend to change with each revision as the PCB layout comes together. After a bit of fiddling I got the program to light up the RGB LED at full brightness:

Problem Two: the LED hole is too small. It's not super clear in the picture above, but to my eye the 'gear nucleus' is a bit on the thick side. Not a huge deal, I just need to revert the footprint back to the v0.8 iteration.

I then modified the full v0.8 runtime program and tried loading it up. This took more tinkering, as I needed to ensure that both motor mode PWM outputs were active on the two axons, and had to track down some fussy code related to the MODE switch. All seemed well when I loaded the code up--the LED turned a nice green and all--and then...

Problem Three: one of the axon connections makes downstream NeuroBytes continuously fire, even when the upstream board is at rest. A check with the voltmeter confirms that the signal line is high all the time. And worse...

Problem Four: HEAT! After leaving the board plugged in for a few seconds, I noticed the ATtiny was starting to warm up a bit. It took time to track down the exact source; at first I assumed it was the LDO or some of the associated circuitry, but a good deal of probing narrowed down the source to the microcontroller.

NOT A TYPO--I am reusing the same picture. In this case, the top arrow points to the non-regulated VCC bus, and the bottom arrow points to the AXON2-SIG test pad. See how they overlap? Yeah, that is not supposed to be the case. That's what happens when you place components after laying traces, and then don't run a DRC. Lesson learned. Low microcontroller pin + dead short to VCC = turn ATtiny88 into an expensive resistor.

I used a razor blade to slice the pesky test pad away from the AXON2-SIG connector, and as expected both Problems Three and Four disappeared. This allowed me to score my first victory: two servos working off the same NeuroBytes board!

Far more significantly, I also spent an hour or so thoroughly testing the circuit's ability to survive hot-swapping servos. Even using much heavier duty units (the continuous rotation devices from NeuroBuggy), I didn't see a single reset event or visible LED fade. I tried 'scoping the regulated power rail and never saw more than a ~200mV sag when servos were plugged in. I also hooked a set of power wires onto an unregulated 6vdc battery pack and it worked like a charm--so I'm calling that problem solved!

As you may have expected, the victories were short-lived. I added a bit more code to read the analog potentiometer input; if you haven't used AVR-C before, it's a bit more complex than the Arduino analogRead function:

/* set up ADC */

DDRD &= ~(1<<PD6); //ensures data direction register for PD6 is set as 'input'
PRR &= ~(1<<PRADC); //ensures power reduction bit is cleared
ADCSRA |= (1<<ADEN); //enables ADC
ADCSRA |= ((1<<ADPS2) | (1<<ADPS1)); //prescales ADC clock to 125 kHz
ADCSRA |= (1<<ADSC); //starts running ADC conversion (free-running by default)
ADMUX |= (1<<ADLAR); //left justifies ADC result (just grabbing 8 MSBs)
ADMUX |= (1<<REFS0); //ensures ADC references AVcc
//note: MUX[3:0] set to 0000 by default which selects AIN0
As the comments suggest, the various registers get the ADC fired up at the proper rate (clk/64, which is 8MHz / 64 = 125 kHz), select the right channel on the mux (channel 0), and do a few other housekeeping things. But... it didn't work. My test program didn't change the LED brightness, no matter how many times I twisted the potentiometer.

Why?

Problem Five: AIN0 is NOT an ADC channel. It's one of the inputs to the analog comparator! Yes, when I was pulling the potentiometer into the circuit I just made assumptions based on pin names rather than actually checking the appropriate section of the datasheet:

I had six [multiplexed] ADC options and I chose none of them! Yes--if I'd paid attention I might have wondered where 'AIN2' through 'AIN5' were, since I knew the ATtiny88 had 6 ADC channels. But I was in a hurry so this never crossed my mind. Ugh!

So the easy solution is to move the potentiometer to one of the six ADC channels (pins 19-24), relocating a dendrite signal or type line as needed. However, I also ran into an issue with the potentiometer itself, beyond the previously mentioned pad layout mistake and extra silkscreen:

Problem Six: it's really easy to strip the adjustment screw on the potentiometer. Okay, fine, I used a Philips head screwdriver to adjust it, which wasn't the right tool for the job, but can I really expect end users to not misplace the tiny plastic adjuster I'd need to supply with each kit?

I suppose that is the strategy littleBits has adopted; as shown above, their Light Sensor Bit uses the same model potentiometer and includes a tiny purple screwdriver. But I think we're going to do something else. Stay tuned--v0.91 boards get ordered today!

Discussions