Solar Power isn't Feasible!

Solar Power isn't Feasible!
This cartoon was on the cover of the book "SolarGas" by David Hoye. It echoes the Sharp Solar slogan "Last time I checked nobody owned the sun!"

Saturday, October 13, 2012

Using inexpensive 2 pin Infra-red transmitters and receivers with Arduino

Solar CITIES is moving into environmental sensing training in developing countries and impoverished areas in developed countries.  That means besides teaching folks how to build their own biogas and solar and other renewable energy and water and waste systems, we are increasingly going to integrate training in... environmental robotics.

We realize that, as Paul McCartney famously sang, "you used to say live and let live, you know you did, you know you did; but in this ever changing world in which we live in, makes you give it a cry... say live and let die!" And we don't like that (though we love the song and the movie; as long as it is fiction...)

There is talk about the "47%" by one candidate and the "30%" by his vice-candidate, and it isn't nice talk.  There are promises being made  of 12 million new jobs in 4 years by the pair of them, but it isn't realistic talk. The fact is that the micro-controller revolution is enabling artificial intelligence to be embedded in everything.  Computer programs and robotic machines will replace most jobs.  That isn't a bad thing, since most jobs leave much to be desired, and many are degrading for any sentient being. But it does create a problem for people whose skills are being outsourced not just to other countries but now to other beings. Non-human beings. Non-biological beings. AI empowered, environmental sensing machines.

At Solar CITIES we embrace new technologies. But we want to make sure that everybody gets a fair shot at learning how to creatively work with these new technologies and these new silicon based beings so that nobody from the carbon based life form camp is left behind who doesn't want to be.

  Environmental technologies, including solar, biogas, wind and other energy technologies, and various water and waste management and food production technologies, are being automated. That is a wonderful development which should increase their effectiveness and cut down on their costs so they can be deployed everywhere.  And the key to improving both our technologies and our  environments is good environmental sensing.

We and our robots need to be better aware of our surroundings, and everybody who wants to needs to be able to design, build, install, troubleshoot and repair environmental sensing and manipulation technologies that can make their environment better.

Enter the Arduino

Since the release of the open source Arduino micro-controller and Integrated Development Environment (IDE, the software to control the micro-controller) embedded computing, sensing and robotics have suddenly become understandable and affordable for everyone.  An Arduino Uno controller, used now with various sensors around the world to monitor temperature, pH,  pressure, proximity of objects, light levels, colors and a host of other parameters that once demanded dedicated expensive equipment, costs only $30. The software is FREE. Tutorials on how to use it are also free, with a huge and generous open source community posting every day.

The other vital piece of the puzzle is using inexpensive sensors.  And the fact is that their cost is coming down all the time.

Basic Environmental Sensing 101

Most larger organisms on this planet use light as their principle means of interacting with their environment. Some use light and heat, but heat is often detected as a form of light (longer wavelengths in the electromagnetic spectrum than the ones we call "visible light") so it amounts to almost the same thing.

There are other ways of detecting one's surroundings -- hearing is another, depending on pressure waves (i.e. sound waves), and we all know that bats and cetaceans (dolphins, whales, porpoises) use sonar as does the Navy.

Then there is touch, and taste and smell (the latter two involving chemical gradients).

Now we are equipping our machines and our devices and all of our systems with different variations of these 5 senses so that they can become aware of their environments and report to us data about our changing world as well as control actuators that can change the environment (think of turning on heaters or cooling systems, blowers, pumps, irrigation systems, nutrient loading systems, cleaning systems etc.).

The simplest system to start with, to get involved in environmental sensing technology we believe is to start with light.  With simple eyes.  And the least expensive of those is probably the Infra-Red emitter and receiver.
One sends out a beam of invisible infra-red light, which bounces off an object and reflects back to be picked up by the other one, a receiver.  This is the sonar that bats and dolphins do, and you can do it too, for very little money.

The simplest IR sensor: A pair of 2 pin IR diodes

In this post I would like to give you an introduction to the idea of using very low cost Infra-red sensors to measure distance or detect objects or avoid collisions.  Generally people tend to spend between 10 and 20 dollars for Infrared range finders like the excellent Sharp IR range finder series (I'm experimenting with the Sharp 2D120X for close range detection; it goes from 4 to 30 cm).  But even that can really add up if you are trying to detect objects from many angles or are using many of them.

A cheaper alternative is to use simple  IR components, i.e. a simple IR transmitter and a simple IR receiver.  You can find many tutorials on this; the problem is that most demand the use of a 3 pin receiver, and in some areas (like where we live) the local stores don't always carry them.

Here is a great tutorial,  for example,  from Garage lab on setting up a simple IR transceiver with arduino that uses a 3 pin receiver:  http://garagelab.com/profiles/blogs/tutorial-arduino-ir-sender-and-receiver

You'll find a lot of these as you hunt around. The problem is that you don't find much about using the really inexpensive  two pin infrared  receivers that we find in most places.

Because of this lack of information I thought I would post something quick here to help those struggling with this.

What we are experimenting with now is using the IR transceiver 2 pin pair sold at Conrad Electronics.
We are using an LPT 80 A Receiver for 98 cents, and a IRL 80 A Transmitter for 85 cents. These are both two pin IR diodes.

Here is a picture of a basic test design to see the signal in the serial monitor:



This is a very simple set up: The IRL 80 A IR sender (glowing blue at bottom right) has its long lead connected to arduino 5, the short lead to ground. Behind it is the LPT 80 A IR receiver (hard to see because clear) with its long lead connected to 5V and short lead connected to both A1 on Arduino and to a 10 K resistor that goes to ground. The closer the sender and receiver are, given that we made the sender shorter than the receiver so they don't block, the better they work, but this is hard on a bread board. Better to make a little pcb and snug them right up to each other. 

 The schematic we used came from the generosity of Robotronics, reproduced below:


 
The code is very basic to read the changing signal on the serial monitor.

// Pin 13 has an LED connected on most Arduino boards.
int led = 12;
int IRSled = 5;
int IRRled = A1;
int val;

// the setup routine runs once when you press reset:
void setup() {

Serial.begin(9600);
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
pinMode(IRSled, OUTPUT); //IRS is InfraRedSender
pinMode(IRRled, INPUT); // initialize the infrared receiver
}

// the loop routine runs over and over again forever:
void loop() {

digitalWrite(led, LOW); // turn the LED off  (HIGH is the voltage level)
digitalWrite(IRSled, HIGH);

analogRead(IRRled);

val = analogRead(IRRled);
 if (val <= 300) digitalWrite(led, HIGH);

Serial.print(val);
Serial.print(" ");
Serial.println();
delay(10);
}

video
If you want to see this set up in action giving a robotic car the ability to avoid objects, check out Spark-fun's ProtoSnap MiniBot kit ($79) which is basically a tiny arduino with a usb converter board and a motor controller board using similar two pin IR transceiver pairs for collision detection.  It turns whenever it encounters an object on either side of it, as if it had eyes on the side of its head like an ungulate.

Here is mine:

The bottom line is that if we are going to be able to preserve our environment in a cost effective way, we need to enlist the help of environmental sensing technologies.  The idea of giving our homes, farms, gardens, offices, and in fact every object or location we value their own five senses -- eyes, ears, noses, tongues, fingers and sensitive skin -- is not at all far fetched.  The idea that we can all learn how to create and work with environmental sensing robotics is not far fetched either.

We hope you will join us in making a world where robots don't replace humans but give us all the chance for a more dignified meaningful, fun and healthy, sustainable life.

Look for more introductions to the world of environmental sensing technologies that you can build yourself here in our Solar CITIES blog and in our workshops!


..........
For more on environmental sensing robots check out this BBC Future article on a hybrid electronic-organic robot  that uses "cyberplasm" for sensing water pollution:

http://www.bbc.com/future/story/20121010-sink-or-swim-for-biohybrid-robot

No comments: