Babygnusbuino

From SGMK-SSAM-WIKI

Jump to: navigation, search

THERE's a NEW VERSION with more free pins n stuff ! Visit Babygnusbuino-v2

Babygnusbuino.jpg

A ridiculously small Arduino with USB interface for bootloading and/or MIDI connection, based on the gnusb / Gnusbuino project.

Really bare-bones, no protection, no FTDI chip, single-sided PCB, no holes. The USB connector is directly etched on the board, so you actually plug in the PCB itself to upload a new sketch to the Arduino.

BabyGnusbuino new lifepatchversion3.jpg

BabyGnusbuino 2.jpg

Attention This project is still work in progress - more of a proof of concept. I'm able to upload a blink sketch and it works, but there is some testing to be done. Hardware design could change - not sure if this is the best pin configuration - and the bootloader is a bit sketchy…

Contents

Building

Parts List

The only parts needed are:

Circuit Schematic

Babygnusbuino schematic.png

Pin Definitions, v2

// ATMEL ATTINY85 / BABYGNUSBUINO
//
//                        +---\/---+
//   !RESET (AD 0) PB5   1|        |8  VCC
//     (D3/A3)PWM? PB3   2|        |7  PB 2 / USB+	
//     (D4/A4)PWM? PB4   3|        |6  PB 1 / USB-
//                  GND  4|        |5  PB 0 / USB-PULLUP (D0/A40)PWM?
//                        +--------+
//

New pin definitions file: File:Pins arduino.h.zip put in ./sketchbook/hardware/Gnusbuino/variants/attiny85

Pin Definitions, v3 as DigiSpark

Pin outs: All pins can be used as Digital I/O

// ATMEL ATTINY45 / ARDUINO
//
//                         +-\/-+
//        Ain0 (D 5) PB5  1|    |8  Vcc
// USB+ / Ain3 (D 3) PB3  2|    |7  PB2 (D 2)  Ain1
// USB- / Ain2 (D 4) PB4  3|    |6  PB1 (D 1) pwm1
//                   GND  4|    |5  PB0 (D 0) pwm0
//                         +----+

PCB

File the board so that the brackets around the DIY USB connector are just barely visible, this should give the right fit.

Most PCB material is a little too thin, so this connector wiggles a lot inside the USB port - it's best to glue some cardboard or thin aluminum to the back of the board to make it slightly thicker.

Full SMD version

Scaled 400%

Babygnusbuino smd.gif

File:Babygnusbuino smd.pdf

DIL version

Scaled 400%, die löcher grad wegmachen oder.... ist ja pseudo-smd

Babygnusbuino dil.gif

File:Babygnusbuino dil.pdf


Bio Baby hackteria DIL/SMD-version

BioBaby v1 color web.jpg

LIFEPATCH-BabyGnusbuino DIL-version

BabyGnusbuino lifepatch v3 color web.jpg

BabyGnusbuino lifepatch v4 color web.png

File:BabyPatchuino DIL v03.zip

!ATTENTION: DESIGN MISTAKE. THE USB PLUG IS TOO SHORT!

Mask v0.4: File:BabyPatchuino MASK v04.pdf

BabyHONFuino DIL-version

BabyHONFuino v0 color web.jpg

BabyGnusbuino 2.0 with case

BabyOD v9 general.jpg

Mask v2.0: File:BabyOD v9 general.pdf

Programming

Source Code

The source code can be found in the SVN repository of the Gnusbuino [[1]]

Building / Installing

Hardware schematics and source code are in the SVN repository at http://gnusb.svn.sourceforge.net/viewvc/gnusb/branches/gnusbuino/

You can either download the two folders and add their contents to the corresponding folders in your Arduino working directory, or you can pull the latest version directly through svn.

cd "the/path/to/Arduino/"    (for me on a Mac it is cd ~/Users/me/Documents/Arduino)
svn co https://gnusb.svn.sourceforge.net/svnroot/gnusb/branches/gnusbuino/hardware
svn co https://gnusb.svn.sourceforge.net/svnroot/gnusb/branches/gnusbuino/libraries

later on, you can always update to the latest version by typing

svn update

Flashing the bootloader

The Bootloader is based on the USBasploader-tiny85 [[2]] - and of course on V-USB [[3]], the virtual USB driver from objective-development.

To get as small as possible, the board does not contain a ISP connector. We'd need it only once to flash the bootloader, anyway. From then on the chip can be reprogrammed directly trough USB. In order to flash the small outline smd chip, I made an adapter plate for the Gnusb-Prog (see: [[4]]) - where the chip is mounted temporarily and held in place with a paper clip:

Tiny smd prog.jpg Tiny smd prog clip.jpg

File:Babygnusb programmer eagle.zip

File:Tiny prog smd.pdf


Bootloader:

avrdude -P /dev/ttyUSB0-b 19200 -c avrisp -p t85 -U flash:w:attiny85.hex:i

Fuses:

avrdude -P /dev/ttyUSB0 -b 19200 -c avrisp -p t85 -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m -U efuse:w:0xfe:m

maybe change the devices on your OS

Avrdude issues

Unfortunately, the current ATTINY85 bootloader does not cope well with the speed at which it gets its data from avrdude, so the Arduino IDE does not work out of the box to program the Babygnusbuino. You'll have to compile a slower version of avrdude and replace the one that comes with Arduino (inside the Arduino Application).

(from my read me file:)

        ./configure
          make

see also https://github.com/embedded-creations/USBaspLoader-tiny85/issues/1

Still, I sometimes have to try uploading three times until the "broken pipe" errors go away. Still work to do on this bootloader, guys…


Precompiled Binaries

MacOS X

Here is a patched version of avrdude - compiled for MacOS X 10.7. Nut sure if it works with other versions.

File:Avrdude tiny85 hack.zip

this is the compiled version of avrdude with libusb, i tested it on snow leopard and mountain lion so it should works on lion too (manticore)

File:Avrdude.5.11.1-libusb.zip

win 7

Here is a version of avrdude - compiled for Windows 7 x64

File:Avrdude-5.11-win7-x64-Gnusbuino-Hack.zip

A manual on how to compile avrdude for windows from source can be found here: http://tomeko.net/other/avrdude/building_avrdude.php (Note for the manual: in the libusb version 1.2.6.0 you have to rename "lusb0_usb.h" to "usb.h" so the avrdude source compiles fine.)

Uploading a sketch

When you plug in the Babygnusbuino it will first start into the bootloader and present itself as "USBasp" to the host computer. After about five seconds, if there's no activity, it will automatically start the main program. To upload a sketch:

  1. plug in Babygnusbuino
  2. within 2-3 seconds hit the "upload" button in Arduino

Sometimes I have to try several times - the timing is not always easy to get right. Also, bootloader is still a bit shaky, doesn't work every time. Be sure to read the results in the debug window.

Questions

Baby midi pd.png

Arduino baby error.png

Installing it on ubuntu 12.04/linux (dusjagr)

# USBtinyISP Programmer rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c9f", GROUP="adm", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="0479", GROUP="adm", MODE="0666"
# USBasp babygnuspuino Programmer rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", GROUP="adm", MODE="0666"
sudo restart udev

Ideas

other stuff

der frickelt auch mit ner spezial version von arduino.... http://www.kickstarter.com/projects/digistump/digispark-the-tiny-arduino-enabled-usb-dev-board/posts/350928

Example Code

Baby is alive | BabyGnusbuino

/*
 Fading hearbeat on pin 0
 
 */
 
int ledPin = 0;    // LED connected to digital pin 9
 
void setup()  { 
 
  TCCR0B = TCCR0B & 0b11111011; //timer pre-scaler divided by 8
 
pinMode (ledPin, OUTPUT);
 
} 
 
void loop()  { 
  // fade in from min to max in increments of 5 points:
  for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=1) { 
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fadeValue);         
    // wait for 30 milliseconds to see the dimming effect    
    delay(1);                            
  } 
 
  // fade out from max to min in increments of 5 points:
  for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=1) { 
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fadeValue);         
    // wait for 30 milliseconds to see the dimming effect    
    delay(1);                            
  } 
}


Midi to pd sieche | BabyMidiGnusbuino

PD part

download the pd siech File:BabyMidi.pd.zip

Baby midi pd.png

arduino part

/*---------------------------------------------------------------------------------------------
 
  Gnusbuino MIDI Library 2012 by Michael Egger
 
  SEND CONTROL CHANGE EXAMPLE combined with RECEIVE NOTE
  Read a potentiometer and send its value as a continuous controller message
  Control an LED  
 
  This example code is in the public domain.
 
--------------------------------------------------------------------------------------------- */
/* The circuit:
 * Potentiometer attached to analog input on pin 3, center pin of the potentiometer to the analog pin
 * one side pin (either one) to ground,  the other side pin to +5V
 * Put an LED on pin 4 to turn it on and off.
 */
 
 
#include "MIDI.h"            // you have to include the Gnusbuino MIDI library
 
MIDIMessage message;
 
int LED = 4;
int sensorValue = 0;         // variable to store the value coming from the sensor
int sentValue = -1;          // we only want to send data when there's something changing
                             // so we have to keep track of the last value that was sent to the host
int sensorValueLB = 0;
 
void setup() {               // nothing to do in setup, pins are inputs by default
 
}
 
 
void loop() {
 
  sensorValue = analogRead(3) / 8;                       // analogRead returns 0-1023, we need 0-127
  if (sensorValue != sentValue) {                         // compare actual readout to last sent value    
 
      //MIDI.write(MIDI_CONTROLCHANGE, controller number , controller value )
 
        MIDI.write(MIDI_CONTROLCHANGE,1,sensorValue);     // put new control change message into MIDI sending queue
        sentValue = sensorValue;                          // store last sent value
  }
 
    delay(10);              // give some time for sending, otherwhise the MIDI queue could fill up
 
  if (MIDI.read(&message)) {
 
        switch(message.command) {
            case MIDI_NOTEON:
              digitalWrite(LED,message.value);        // MaxMSP actually sends "noteon x 0" instead of "noteoff"
              break;
 
            case MIDI_NOTEOFF:
              digitalWrite(LED,0);        
 
        }
    }
 
}

more code examples

BabyGnusbuino code examples

Experimental: Babygnusbuino v.2.0

Version 2.0 frees up RESET pin, uses PB5 (Reset) and PB3 for USB. Three Hardware PWMs. more to come

Github repository: https://github.com/mirdej/babygnusbuino

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox