littleBits-->NeuroBytes adapter

A project log for NeuroBytes

Build your own nervous system!

zakqwyzakqwy 06/04/2016 at 21:050 Comments

A @littleBits to NeuroBytes input adapter has been on the back burner for far too long. Today, I used my Hardware Development Kit Proto Module to tie directly into a NeuroBytes v0.8 board:

During the v0.8 design, I didn't intend to use any of the ATtiny88's analog input channels. However, by a happy coincidence a few of them corresponded with the six ADC channels; in particular, I was able to use the Dendrite 4 signal pin as it ran to PC5, which is ADC5. This pin is connected directly to the littleBits signal line in the video above, which varies between 0 and 5 VDC during operation. I modified the v0.8 Izhikevich code to pull membrane current from this ADC channel after a double right shift; this scales the ADC channel from 0 to 63:

//ADC setup:

DDCR &= ~(1<<PC5); //only need PC5 (ADC5, dend4) set as an input
PRR &= ~(1<<PRADC); //ensures power reduction bit is cleared
ADCSRA |= (1<<ADEN); //enables the ADC
ADCSRB = 0; //ensures ADTS[0:2] = 0 for Free Running Mode
ADCSRA |= ((1<<ADPS2) | (1<<ADPS1)); //prescales ADC clock to clk/64 (125 kHz)
ADMUX |= ((1<<MUX2) | (1<<MUX0)); //MUX[3:0] = 0101 selects ADC5 (before start command!)
ADMUX |= (1<<ADLAR); //left adjusts ADC result
ADMUX |= (1<<REFS0); //ensures ADC references AVCC
//updateModel(uint8_t stage) change to pull in ADC result:

if (stage == 0) {
    ADCSRA |= (1<<ADSC)); //starts running ADC conversion
if (stage == 1) {
    I = (ADCH >> 2); //sets Izhikevich membrane current value to Dendrite 4 input value (scaled 0..63)

The potentiometer input video is a pretty basic demonstration of the effects of changing the Izhikevich membrane current value between 0 and 63 has on the NeuroBytes board firing rate. Stuff gets a lot cooler once you attach a littleBits Light Sensor Bit, switched to Dark mode with the sensitivity adjusted to detect the shadow from my hand:

The video above is interesting because it's a blinky LED that responds to ambient conditions. It's amazing because this actually demonstrates how photoreceptors in your eye function; as much better explained in the Khan Academy video below, a presence of light causes the rod cell to hyperpolarize and stop firing:

NeuroBytes v0.91 boards were ordered yesterday, and among several other changes to fix previously discussed problems with v0.9, they have all five dendrite signal lines connected to ADC inputs. You can probably see where this is going, but if not--just know that I'm about to order a lot of littleBits.