loading

34five is an electronic pet that reacts to acceleration.

In the following Instructable, we’ll guide you how to build a simple interactive creature, providing you software and design instructions. This is also a great way to start getting to know the world of micro-controllers and code.

All you need to do is follow a few simple steps.

Enjoy making :)

Step 1: Welcome to Your Virtual Workshop!

If you’ve never used Circuito before, then here’s a quick overview: there are three main parts to Circuito.io's interface:

#1 Input components: different types of sensors

#2 Controller and Power: currently we support different types of Arduino

#3 Output components: Motors, LEDs, and more

Take a moment to explore the different options.

Step 2: Choosing Your Components

If you click on this magic link, you'll see all these components already selected for you on Circuito.io.

# Choose an Input: Accelerometer

The first thing you’ll need to do it choose an input. This component allows us to detect information from the physical environment, so it’s just like our five senses. In this case we chose to use the Accelerometer input option, which will collect information about the velocity of our electronic pet.

# Choose a Controller: Arduino Uno

The micro-controller, is actually your pet's “brain” - it processes the input signals.
Arduino boards are accessible and we recommend that you use the Uno as your default choice. It will get you started quickly because all the parts can be assembled by plugging in connectors, plus it's cheap and reusable for future projects.

# Choose a Power Supply: Battery pack
In order to function, your pet will need to eat. Hopefully, it will only consume electrical energy :) Something to take into consideration here is that you'll probably want to go for a walk with your pet, therefore it will require batteries.

# Choose an Output: Piezo speaker
To get a real feel out of your cute friend we thought it would be nice if it could "speak" when moved around. A Piezo speaker will do the trick here.

Step 3: Schematic & Code

Once you click on CREATE CIRCUITO, our generator will create custom schematic and code according to your selection. Once it's ready, click on OPEN MY CIRCUITO.

First, there is a list of all the parts you need to build the pet, its organs if you will.

Then, you'll see an animation of all connections that need to be made. This is especially convenient for beginners who have a hard time figuring out what goes where.

Finally, our amazing machine generated two links to get the application allowing to program the micro-controller, and the “mind” code. For this specific project, we also uploaded the code to Instructables, and you can see it at the end of this step.

# We recommend that you first upload the code from Step-by-Step, make sure that everything is connected properly, then upload the new code that appears below.

# You will also receive schematic and code to your email, just in case.

# The code that appears below needs to replace the .ino file in the folder you downloaded. All the other components need to remain as they are.

# If you've never used Arduino before, follow the steps below:

Download this software, which can be used with any Arduino board.
Refer to the Getting Started page for Installation instructions.

#include "Global.h"
#define THRESHOLD_ADXL345	20

const int numReadings = 5;
int readings[numReadings];      // the readings from the analog input
int readIndex = 0;              // the index of the current reading
int total = 0;                  // the running total
int average = 0;                // the average

void setup() {
  // Setup Serial which is useful for debugging
  // Use the Serial Monitor to view printed messages
  Serial.begin(9600);
  Serial.println("start");
  for (int thisReading = 0; thisReading < numReadings; thisReading++) {
    readings[thisReading] = 0;
  }
}

void loop() {
  delay(100);
  // Update current accelerometer values
  adxl.update();
  avg();
  int diff = average - adxl.getZ();
  if (diff > THRESHOLD_ADXL345) {
    // This example shows the tone function.
    // Uncomment it to use it.
    piezoSpeaker.tone(diff + 380); // play a 400Hz tone
    delay(70);            // keep playing it for 500ms
    piezoSpeaker.off();     // stop the sound
  }
}

void avg() {
  // subtract the last reading:
  total = total - readings[readIndex];
  // read from the sensor:
  readings[readIndex] = adxl.getZ();
  // add the reading to the total:
  total = total + readings[readIndex];
  // advance to the next position in the array:
  readIndex = readIndex + 1;

  // if we're at the end of the array...
  if (readIndex >= numReadings) {
    // ...wrap around to the beginning:
    readIndex = 0;
  }

  // calculate the average:
  average = total / numReadings;
  // send it to the computer as ASCII digits
  Serial.println(average);
  delay(1);        // delay in between reads for stability
}

Step 4: 3D Print the Body

We designed a 3D printed body that fits the different organs of the 34five Arduino pet perfectly.

You can use the attached .STL file and print it or you can design it in your own style, as you wish.

Step 5: Congratulations!

You're all done!

You can now take your 34five Arduino pet for a stroll.

We'd love to see pictures and videos of the creature you created with our schematic and code.

Also, if you have an idea for a new project you'd like to make, visit circuito.io for more schematic and code.

Connect with us on facebook and tell us about your new projects.

About This Instructable

332views

1favorite

License:

Bio: Circuito.io is an automatic web tool that will help you build almost any innovation you have ever dreamed of, by breaking technical barriers and ... More »
More by Circuito io:Giftduino - The Arduino Gift Box That Keeps on Giving Valentine's Sunflower Simple Arduino-based thermometer 
Add instructable to: