Published

Binduino

About a year ago, I went along to the Code the City Hack at the Informatics Forum in Edinburgh. This was the forth Code the City event and the theme was the environment. I joined a team working on making rubbish collection more fun and we built an Arduino based talking rubbish bin. At the end of the weekend the bin had to be dismantled, as we didn’t own any of the components. I thought it might be a good idea to try and rebuild the bin and write up a set of instructions.

The Bin plays sound effects when you drop rubbish into it. The effects can be recorded as .wavs and uploaded onto the device over USB. We themed our Bin as though it was a monster that liked eating rubbish so that’s what I’ll be doing for this tutorial.

Components and Supplies

At Code the City, we used a bunch of components browed from one of the organisers. Unfortunately he took them home at the end of the day and I can’t remember exactly what they were. So I’ve just rebuild a similar system using parts that I could get from online. For this project you will need:

Electronics

Arduino Uno

One Breadboard

Adafruit IR Break Beam Sensor

Adafruit Audio FX Sound Board

Philips SBA1610/00 Portable Speaker

Assorted Multicolored Jumper Wires

USB Battery Pack

Headphone Extension Cable

USB Cable Plug Type A to Plug Type B

Other Components

Your choice of bin!

Some bluetack and sticky back plastic.

Some way of decorating the bin – pens, paint, stickers etc.

Note that in the original build the Adafruit sound board was replaced with Bare Conductive Touch Board, which was as straight forward to use. As I don’t own one of there boards I’m not going be able to cover how to get it working in detail. However the steps should be quite similar.

Instructions

We are going to start by connecting up the electronic components separately from the bin. Then we will move onto programming the Arduino to activate the samples on the Audio Board when the IR Beam is broken. Finally we will mount the system inside the bin and decorate the outside in a monstrous fashion.

Step 1 – Power the breadboard from the Arduino’s 5V output.

To do this we use connect the 5V power pin on the Arduino to the lowest row on the breadboard (marked +) and one of the ground pins on the Arduino to the second from bottom row on the breadboard (marked -).

Step 2 – Attach the IR Beam Sensor

The IR beams has two parts, one that emits the infrared and one that receives it. Both need powered by plugging the red cable into the + row of the breadboard and the black cable into the – row of the breadboard. The receiver has a yellow cable that plugs into any digital input on the Arduino and switches from a LOW to a HIGH signal when the beam in broken. For this project we are going to plug it into pin 4.

Adafruit, who manufacture the sensor I used, have a discussion about it’s use here.

Step 3 – Attach the soundboard

Next we will attach the soundboard to the breadboard using a small bit of bluetack and wire it up to the Arduino. The board is powered though ports marked VIN and GND. Connect VIN to the + row on the breadboard and GND to the – row.

Normally we would used red cables for + and black cables for – but in this case I didn’t have any cables of the correct colours and lengths. We also need to be able to signal to the soundboard to play the sample. We are going to load our samples onto the board later but for now we just have to connect one of the sample trigger pins (marked 0-10 on the top of the board) up to a digital pin on the Arduino that can be set to output. In this case, I’ve used pin 8. Note that to trigger the sounds we set that pin to a ground voltage of 0 volts, so the pin will need to be set to an initial value of HIGH.

See a more comprehensive discussion of the soundboards various pins here.

Step 4 – Recording some sounds

Having wired up the system, it’s time to record some things for the bin to say when we drop rubbish into it. To record the sound effects I used the built-in mic on my laptop and the open source recording software Audacity. The sounds need to be recorded as .wav or .ogg files.

To upload the files we plug the soundboard into a PC where it will appear as a normal USB drive. The trigger pins are set to trigger sound files with specific names. As we re using pin 1 on the soundboard we want to upload our file with the name T01.wav. More detailed upload instructions can be found here. Remember that the soundboard only has 2MB of store, so make sure your sounds fit into that amount of memory.

Step 5 – Writing some code

With the bins responses uploaded onto the device, we need to write the code that tells the Arduino to send the signal to play the sample, when the IR beam is broken. The IR beam is attached to digital pin 4 and the trigger pin for the soundboard is attached to digital pin 8. We will define these at the top of our file.

In our setup function, we set the pin 4 to input with and initial value of HIGH and pin 8 to output with an initial value of LOW. Then in the loop function, which is called back every tick of the Arduino’s clock, we read the state of the IR beam. We then test it against the last recorded state of the IR beam and if it’s changed, we decide if we should play the sample. To play the sample we set pin 8 to LOW and to prevent the sample from playing again we set it to HIGH.

C++

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

#define SENSORPIN 4

#define SOUNDPIN 8

intsensorState=0,lastState=0;

voidsetup(){

pinMode(SENSORPIN,INPUT);

digitalWrite(SENSORPIN,HIGH);

pinMode(SOUNDPIN,OUTPUT);

digitalWrite(SOUNDPIN,HIGH);

}

voidloop(){

sensorState=digitalRead(SENSORPIN);

if(sensorState&amp;&amp;!lastState){

digitalWrite(SOUNDPIN,HIGH);

}

if(!sensorState&amp;&amp;lastState){

digitalWrite(SOUNDPIN,LOW);

}

lastState=sensorState;

}

Add the above code snippet into the Arduino editor, plug your computer into the Arduino, compile and upload! If you are unsure about how to do all of that then check out Arduino Getting Started Guide on their homepage.

Step 6 – Powering it up and testing

At this point we have done a lot of putting things together, some coding and not any testing at all. This is not great product design practice so we had best do a little test. With the computer still plugged in for power, check that the red light on the soundboard triggers on and off when you hit the beam. Here’s a picture of the red light when it’s on:

Now unplug the computer and plug in the USB power pack. Test to make sure the system is still working by breaking the beam again. You can also test by plugging a pair of headphones into the audio jack output on the soundboard. You should hear the sample that was recorded.

Step 7- Putting it in the bin

At this point we have a working system! All we need to do now is to install it into the bin. I secured all the parts into the bin using bluetack and sticky back plastic. I think in a version that would see a bit more use you would want to add some containers around the electronics.

I also plugged in the speaker into the audio jack of the soundboard and secured them to the bottom of the bin.

Then you just need to add the bin bag, draw an bit monster face on the bin and you are done.

Step 8- Enjoy the talking bin

And we are done! Congratulations (hopefully) you are the owner of a Moster Binduion! I’m just putting the finishing touches to my one and I’ll be posting up the results in the next couple of days as an update to this post. Hope this was helpful!

Parts Prices List

Here are cost of the electronic components of the build.

Arduino Uno £18.01

One Breadboard £1.44

Adafruit IR Break Beam Sensor £10.00

Adafruit Audio FX Sound Board £16.95

Philips SBA1610/00 Portable Speaker £8.87

Assorted Multicolored Jumper Wires ~£1.30

USB Battery Pack ~£10

Headphone Extension Cable ~£1.50

USB Cable Plug Type A to Plug Type B ~£1.50

The price of the bin depends of the bin. The one in the pictures cost about £10. That brought the total cost of the build to about £80 which, let’s face it, is to much to pay, even for a talking bin! However the parts are all reusable so I’m hoping that when I get board of the bin there will be something else cool to make them into.

Published

Write a Comment

Webmentions

The amount of written content has been growing exponentially recently, and it’s no wonder. For students, writing is an inseparable part of college and university assignments; for businesses, online publishing is a way to reach customers. The need for…