Hi all.

Hi all.

I am a total beginner to arduino. I have a project on hand which requires me to detech the height level of garbage in a dustbin. Once it reaches the specific height, a message will be sent through wirelessly to alert a group of people.

Been reading up around and asking some of my friends to help me start off. They led me to arduino and said that I could implement it with xbee/zigbee? Could anyone show me a clearer path or send me some info then I can read up. I know that I would have to include some infrared emitter and receiver.

Would really appreciate the replies and help. Thank you :)

well, to detect the height of the rubbish how about a [infrared] led on one side of the bin and a LDR/photodiode/phototransistor on the other. When rubbish is higher than the line the LED will no longer illuminate the light sensor, and you can trigger something to happen there.

An alternative would be to use an ultrasonic sensor on the lid of the bin, measuring the distance between the sensor and the rubbish. I'm not sure how an ultrasonic sensor might handle an enclosed environment though.

As for the wireless, it depends how you wish to contact people. You could use an ethernet shield and instruct the arduino to email a group of people. Or a GSM shield and it could SMS those people. Zigbee/xbee are more for device to device communication, for example you could have an arduino and rubbish sensor at the bin communicating over xbee to another arduino which is connected to the ethernet/a computer, but that seems a little bit pointless as both tasks could easily be achievable with one arduino without the need for an expensive wireless communications shield.

You could use an ethernet shield and instruct the arduino to email a group of people.

If there is an ethernet port near the trash can...

Or a GSM shield and it could SMS those people.

Not likely to be cheaper than XBees.

Zigbee/xbee are more for device to device communication, for example you could have an arduino and rubbish sensor at the bin communicating over xbee to another arduino which is connected to the ethernet/a computer

You would not need an Arduino on either end. The XBee can collect the sensor data and send it without the need for an Arduino to help it. Another XBee and a USB Explorer at the PC end could allow the PC to become aware of the need to empty the trash. What it does about that is entirely up to OP's imagination.

Is this really domestic garbage? Why would you want to fix nice kit to a smelly old garbage can to get it wet, dirty and bashed? Why would the last person to use the can not empty it?

I could understand if this was waste from some kind of automatic industrial process. Then you would need to give some indication of the type of waste e.g. solid/liquid, dust/particles/lumps, dull/reflective, metal/insulator which would lead to ideas on the best way to detect a full bin.

An infrared or laser beam shining on an LDR or photodiode would certainly work if you'd check whether it's interrupted or not. Although it's not the first of April yet, one thing I certainly would include is a loud siren ;-)

Light beam type sensors are the obvious thing to use but be careful with using sensors that respond to the spectrum of the ambient light it may be exposed to as opening the bin may cause light to hit the swensor and cause false positives. Maybe a sheild like a tube to ensure only light directed from the triggering source can hit the sensor?

Depending on the range an rs-232 blue-tooth module may also be an option. It can cost less as zigbee/xbee with... a blue-tooth enabled PC nearby.

If you use a system with interrupted light as detection method it probably should check several times before alerting people. The chance is big the beam will be interrupted when someone dumps some garbage in the bin, which doesn't have to mean it's full yet.

Fortunately a standard Arduino doesn't have to cost much, but it probably is overkill for a project like this. A program to detect and notify the bin's full shouldn't have to be much bigger as 2 KB, communicating doesn't have to take more as 2 pins of the microcontroller and detecting the bin's full could be done with one pin. Smallest Arduinos sold nowadays do have 16KB and 20 IO-pins. Just starting with an Arduino I wouldn't advice you to program a much smaller microcontroller (attiny) with the Arduino IDE, but some here already have done so.

Although a project like this doesn't have to use much power, have you considered how it's going to be powered ?

Thanks guys for your replies and some really creative feedback. Really appreciate it much. XD After reading through the replies, I think I will get the arduino UNO board with the xbee? Good enough? As for the sensors, I would probably get the infrared led and a LDR.

Any good websites to recommend to start me off with the codings? cos I read through the arduino one and it doesnt seem quite informative.

thanks :D

@ Simpson_Jr. Really good pointers down there that didnt cross my mind. Perhaps I would have to look for a battery to attact it with the board. From what I infer from your reply, are you saying that arudino board would cost too much for such a project? If I dont use the LDR, what abt IR emitter and detector? Perhaps programme it to be activated only after the line is interrupted for more than a period of time.

The arduino doesn't cost much, for about $15-$20 it should be possible to buy one. For the finished project itself you may not need everything on the Arduinos PCB though.

For $3-4 one can buy a smaller micro controller powerful enough for your project, You also would need to create your own board which perhaps could be done for about $3-4 as well. Problem with this solution is that you probably need to search/read/understand loads and loads of info to get your first program burnt on chip. With a standard board being just a few bucks more expensive it may not be worth the trouble, certainly for a first project. A ready built board with standard controller is much more forgiving, it's a matter of connecting it to the PC, writing your sketch, choosing the right board in the IDE and uploading your program.

Getting suggestions to program the board...

Problem with a lot of projects is that they each got their individual requirements/ specific components and way of programming. A lot of what you want to do you'll have to find out by yourself.

Personally I would... start with the Arduino tutorial ( http://arduino.cc/en/Tutorial/HomePage) to get a little acquainted with the board and the way of programming. It won't immediately help you with your project, but it will tell you most basic parts even if you don't follow every part of the tutorial.

Next I'd find out how... to work with each individual part of your project. Connect an LDR to the arduino and write a program to just display the level of light on the LDR to your computer screen. You could try to write a routine after that that displays something like "I haven't received any gifts recently", "I just received a gift, but there's still room for more" and... one that says "I'm probably full" if the beam's interrupted for more as 10-15 seconds. Checking SteveUKs suggestion to see what effect ambient light levels have could be done here as well. If the side opposite to the LDR reflects too much light, painting it black may be needed.

After that I'd start checking how.... to connect the Xbee if you choose to and how to communicate with it. It basically uses a serial port and you'll need to configure two of 'm to work with each other using AT-commands. Personally I haven't used one yet, I'd collect every datasheet I could find on it and google "xbee arduino" a lot.

Once you get communication working, you could start merging the LDR- and xbee- program.

Quite a lot of info can be found on the playground http://arduino.cc/playground/, but it can sometimes indeed be hard to find exactly the info you need.

The "World Famous Index of Arduino & Freeduino Knowledge" http://www.freeduino.org/ may give you a lot of info as well.

Personally I often just start googling, quite a lot of people use Arduino for a lot of projects and even googling "Arduino fridge" for example gives a load of results. Quite a lot of info can be found on the Arduinosite, but If you don't know how to connect an LDR or can't find it here, just google "arduino LDR Schematic". You may end up on a page of someone using LDRs for a photography-project or a light-seeking robot, but that doesn't matter much. If the page has some arduino code as well, you could delete the robot/photography part and adapt it to your purposes.

One thing I wouldn't do is start buying expensive stuff.

I'd probably would buy the arduino since you'll need one, but... I'd check most requirements before starting to build the project. For example, what is the distance of the bin to the electronic part receiving messages ? If it's less as 300 ft xbee probably will be able to handle it. If it's not you might... buy two expensive modules which aren't capable of performing the task you have in mind for 'm.

How... would you like to warn the people who have to empty the bin ? If they would need to receive an Email while being miles away you probably need to include an ethernet solution, but if they only need to see a light telling it's full or not you may not even need an Xbee, it may be possible to adapt a cheap transmitter/receiver circuit to open garage doors or... as I suggested as a joke just sound a small siren without any other wireless stuff.

hey thanks guys for your valuable input and suggestion. appreciate it much :D

read up the info and source around myself.

still unsure about one part, if my arduino is going to communicate wirelessly with the computer. and i have decided to purchase the xbee. so i just need to just purchase the xbee shield? or do i purchase the xbee module?

am going to purchase the items soon so just want to double check.

Hi Demetriej,

I decided to answer your PM here, maybe others may find it useful in the future.

demetriej: hey

thanks for your really long and helpful input down there at the topic :D

just want to ask a question.. what's the difference between the xbee shield and the xbee module such as XBee 1mW Wire Antenna?

the arduino and xbee will be tgt and send out data to the computer... so which be more appropriate to use?

once again, your reply is much appreciated!!


Unfortunately I haven't worked with Xbee yet.

The Xbee itself is the transceiver, the shield is a PCB that easily fits the connectors of an arduino and has connectors to hold the Xbee.

Apparently the Xbee needs an 3.3 volt power-supply. By looking at the schematic of the shield I guess not all pins of the XBee are 5volt tolerant and the shield has the right electronics to correct that. (Voltage on the Arduino-pins when High is 5volt, lots of other micro controllers use 3.3)

So you'll need Xbee + shield to work with an arduino, although it may be possible to work without shield if you build the needed electronics yourself.

As far as I understand... the Xbee can work standalone as well, it has several in/output-pins for general purpose IO. In theory you wouldn't need 2 arduino's to set up an RF-link. You may... not even need an Arduino at all since USB-boards without micro controller to connect an Xbee are available as well.

There's a lot to be read about the Xbee, here's a tutorial on Sparkfun which has a lot of interesting info for all kinds of micro controller applications.


Only having read about it it's hard to advice you how you could best setup a link using Xbees though, others here probably can give you far better info.

I hope I don't make making choices worse (quite easy with so much to choose), maybe this link on the playground may be interesting as well before you decide one way or another. http://www.arduino.cc/playground/Main/InterfacingWithHardware#wireless


thanks for the prompt reply, Simpson_Jr. Looks like i have to take quite some time to digest all those info!

my project requires me to collect data on the arduino then using the xbee to send the info via wireless to the computer. is this possible?

because from what i have seen so far, i only see people using xbee to communicate with another arduino. not much on xbee to computer though...

Check the XBee Explorer USB, or just type in "XBee Usb" on Ebay.

The way of commanding an Xbee is serial and works pretty much the same as commanding an GPS unit or old style telephone modem. (of course with different commands and as far as I know...., which isn't much yet)

You'll have to configure the XBee on an Arduino to work serially. You can do exactly the same on your PC using an Explorer board, there's no difference for the XBee itself.

At the PCs end the board will show as a COM-port. You'll need to write a programm for your PC, capable of handling serial ports and showing you the needed info about the bin. I guess almost every programming language is capable of doing that.

Since the XBee exists of an transceiver and small micro controller itself, capable of checking general purpose input pins an handling output, an Xbee at the bin and an XBee + explorer-board may be all you need. An arduino is nice, but in fact it's little more as an repeater emptying batteries faster.

I must say finding good info is indeed quite a job, the info is certainly there, but there's so much that it can be overwhelming. I started the micro controller- hobby ~3 years ago and it sometimes seems like I hardly read/searched anything before that period :)