Unpack the lamp and remove the cable that goes into the lamp from the bottom. You will no longer be plugging this into the wall. You can use a rubber band to strap the Arduino to the breadboard, and then hot-glue the breadboard onto the back of the lamp, as shown in Figure 6-1. Leave some room… Continue reading Here’s How to Assemble It
Assembling the Circuit
Figure 6-2 shows how to assemble the circuit. Just as you did in “Controlling Light with PWM” use a 220-ohm resistor (red-red-brown) with each LED, and just as you did in “Analogue Input”, use a 10 K ohm resistor with the photoresistor. Remember from “Controlling Light with PWM” that LEDs are polarized: in this circuit, the anode (long lead, positive) should go to… Continue reading Assembling the Circuit
Coding
There are two sketches that you’ll be running: the Processing sketch and the Arduino sketch. Example 6-1 is the code for the Processing sketch. You can also download it from the example code. Example 6-1. Arduino Networked Lamp There is one thing you need to do before the Processing sketch will run correctly: you need to confirm that the… Continue reading Coding
Planning
Let’s look at what we want to achieve and what bits and pieces we need. First of all, we need Arduino to be able to connect to the Internet. As the Arduino board has only a USB port, we can’t plug it directly into an Internet connection, so we need to figure out how to… Continue reading Planning
Introduction
We’re going to see how to put together a working application. How every single example can be used as a building block for a complex project. Here is where the wannabe designer in me comes out. We’re going to make the twenty-first-century version of a classic lamp by my favourite Italian designer, Joe Colombo. The object… Continue reading Introduction
The Arduino Alphabet
In the preceding chapters, you learned the basics of Arduino and the fundamental building blocks available to you. Let’s go over what makes up the “Arduino Alphabet”: Digital output We used it to control an LED but, with the proper circuit, it can be used to control motors, make sounds, and a lot more. Analogue… Continue reading The Arduino Alphabet
Complex Sensors
We define complex sensors as those that provide their information in a way that can’t be read with digitalRead() or analogRead() alone. These sensors usually have a whole circuit inside them, possibly with their own microcontroller. Some examples of complex sensors are digital temperature sensors, ultrasonic rangers, infrared rangers, and accelerometers. One reason for this complexity might be to… Continue reading Complex Sensors
Driving Bigger Loads (Motors, Lamps, and the Like)
Each of the pins on an Arduino board can only be used to power devices that use a very small amount of current, such as an LED. If you try to drive something big like a motor or an incandescent lamp, the pin might stop working, and could permanently damage the microcontroller that is the… Continue reading Driving Bigger Loads (Motors, Lamps, and the Like)
Serial Communication
The Arduino has a USB connection that is used by the IDE to upload code into the microcontroller. The good news is that after a sketch is uploaded and is running, the sketch can use this same connection to send messages to or receive messages from from your computer. The way we do this from… Continue reading Serial Communication
Try Other Analogue Sensors
The light-dependent resistor is a very useful sensor, but Arduino cannot directly read resistance. The circuit of Figure 5-6 takes the resistance of the LDR and converts it to a voltage that Arduino can read. This same circuit works for any resistive sensor, and there are many different types of resistive sensors, such as sensors that measure force,… Continue reading Try Other Analogue Sensors