What is The Cocomake?
The Cocomake is a low-cost board based on the ATtiny85 AVR chip. It has a special bootloader that allows it to show up as a USB device (keyboard, mouse, MIDI device). This is very handy, since the ATtiny85 does not have a real hardware serial port on it.
You can write and upload the code for the board using the Arduino IDE or use the online tool called Cocoblockly to create the code visually using a Scratch-like programming environment.
The Cocomake uses the QTouchADC library to get capacitive sensing working on the ATtiny with a minimal amount of external components needed. This means that you can attach all kinds of conductive things (coconuts and other food, metallic objects, conductive ink, conductive textiles etc.) to the board and use them as touch sensors.
Build the Cocomake Board
You should have the following parts (it is slightly different from the BOM on the Cocomake website) :
- 1 x Cocomake PCB board (thank you Shreyasi for making these)
- 1 x ATtiny85 microcontroller
- 1 x 8-pin IC socket
- 1 x USB connector
- 1 x Potentiometer (100kΩ)
- 2 x 3.6V Zener diodes
- 2 x LED
- 1 x 0.1µF capacitor
- 2 x 68Ω resistor
- 2 x 220Ω resistor
- 1 x 1.5kΩ resistor
Solder the parts to the PCB, but do not place the ATtiny chip on the socket yet, we need to flash a bootloader on the chip before the board is usable. You will find instructions how to do this below.
Please note: The PCB we have has a small mistake and is missing a connection to ground for LED2. You can bend the other leg of the LED to touch the big ground copper plane on the board and solder it there. This might require you to hold the iron longer on the contact while soldering since the big ground plane dissipates more heat.
Install the Cocomake Board Definition Files and Library to the Arduino IDE
- Download and Install the Arduino IDE, if you have not done so already.
- Edit your Arduino preferences: Preferences -> Additional Board Manager URLs. Add the line below to the list:
- Open the Library Manager (Sketch->Include Library->Manage Libraries). Search for “coco” and update any libraries that have updates available.
Burn the Cocomake Bootloader on the ATtiny85
In order to get the ATtiny85 to show up as an USB device for on your computer, you need to burn the Cocomake bootloader on the board. You also need the bootloader in order to upload new code to the board using the Arduino IDE. We are going to use the Arduino Uno as the programmer. Check out the Arduino tutorial for more details.
- Upload the ArduinoISP example code to your Arduino Uno (File -> Examples -> ArduinoISP -> ArduinoISP)
- Connect the ATtiny85 to your Arduino Uno according to the image below. Make sure you add the capacitor between the RESET and GND of your Arduino.
- Select “Cocomake7” as the board from the Tools->Board menu in Arduino IDE
- Select “Arduino as ISP” from the Tools->Programmer menu
- Select Burn Bootlader from the Tools menu
- If all goes well, you should get a message in the console saying that the bootlader has been flashed to the device
- The board should now appear as a keyboard to your computer and a space character should be typed when you touch the contact point on the PCB.
How to Upload New Code to the Cocomake Board
The bootloader includes basic functionality for the board as a keyboard, but you can also write your own code for the Cocomake.
- Write your code
- Use the CocoTouch library for reading the sensor
- Use the CocoMidi, CocoKeyboard or CocoMouse libraries for sending the data to the computer
- Make sure your board is set to Cocomake in Tools->Board
- Upload your code (check the console for messages, you might be asked to reconnect your board)
- Use some other software on your computer to convert the messages from the board to something interesting