This is an old revision of the document!
[Photo of Breadboard.png]
Because of a fire at my house where the existing (6 month old) smoke detectors didn't even go off, I decided to build a better set of detectors which do far more than just detect smoke. This design features the mighty Oak with its built in wifi and Particle.io ability to communicate with the world. It includes a MQ-135 air quality sensor which not only senses smoke but also other harmful fumes and gases. It also has a DHT-22 temperature and humidity sensor to give constant feedback to the state of the enviroment. And it has an alarm which goes off when a specified threashold is reached. All of this data can then be pulled from the Oak into Particle.io where it can be accessed by ifttt.com, thingspeak.com or any other monitoring site including one you create yourself. I currently have mine populating several graphs from thingspeak.com which can be viewed here… http://www.intheorystudios.com/oak1 And when the alarm threashold is reached, I get a text message on my phone from ifttt.com I love the Oak and how quickly I was able to bring this design to life. Thanks Digistump!
| Part | Quantity | Identification |
|---|---|---|
| Oak with soldered headers | 1 | |
| Breadboard | 1 | |
| DHT-22 | 1 | Temperature and Humidity Sensor |
| MQ-135 | 1 | Air Quality Sensor |
| 4.7k resistor | 1 | |
| Buzzer or Piezo | 1 | For creating the alarm noise |
| 128×64 OLED Display | 1 | Optional |
[NOTE: You can find an index of the parts in the starter and ultimate kits here: Starter and Ultimate Kit Parts List]
In this section you would cover the concepts new for this lesson. For this lesson that may include PWM (both what it is, how it works, and how to change it in code with tiny code examples), LEDs (briefly what they are, as the first single LED lesson should cover that more in depth), RGB LEDs (how they are different then a single LED, common cathode vs annode, etc), resistors (again in brief as the first single LED lesson should cover that more in depth).
Example of a concept:
PWM: In this lesson we will use Pulse Width Modulation (PWM) to control the 3 different color LED emitters inside the RGB LED. By powering each color from a separate pin of the Oak (through a resistor) we can use the Oak to control how much power goes to each color, which allows us to control the color of the RGB LED.
PWM can be used in your code like this:
analogWrite(0,1023); more code here...
Where analogWrite(0,1023) means turn Pin0 fully on. A value from 0-1023 can be used to turn the pin on at a level from 0-100%.
What is actually happening with PWM: PWM creates an output that averages out to a certain voltage/power level by turning the pin on and off very quickly. The setting you set of 0-100% (0-1023) is called the duty cycle, at 100% the pin remains on 100% of the time, at 50% it remains on half of the time.
Etc, etc, diagrams and images are welcome but each concept should be no more than two short paragraphs and a code block or image.
[Fritzing diagram of hooking the Oak to the RGB LED with resistors and the breadboard]
Steps to make these connections, things to watch out for (polarity, resistor codes etc)
Code to show example of it working
Explanation of code
Where to go from here, potential uses, etc.