Move your hands, point to the air-condition: it turns on! Sounds like living in a magic world, right? With the “Magic Feather Fan”, a new generation of remote control, it is now possible.
Magic Feather Fan is a quite funny toy. Usually, you can use it as a fan. Due to the material of feather and plastic, it’s very light and performs very well.
An additional feature enables controlling the household appliances with your gestures too--it is a gesture recognition device with infrared emitter. Magic Feather Fan makes it possible to control (turn on/off) your appliances (TV/conditioning/ fan and other types of remote-controlled devices) with a mere gesture.
In order to achieve gesture recognition, we will use a 3-Axis Digital Accelerometer to get the acceleration value of gesture motion and process data with our tidy but efficient algorithm. The infrared emitter will emit the infrared signal which match the gesture that you draw.
How to make it ?
1. Preparing materials
- A prototype goose feather fan (about 11 pieces of goose feather + a fan handle which can plug feathers and install the hardware modules)
- A complete hardware circuit, including the infrared emission part and gesture recognition module
For the first part, you can purchase the goose feathers online, and DIY the fan handle by yourself (it can be made of wood, paper, or you can print a plastic one with a 3D printer). Here, we chose to 3D print.
For the second part, we chose Seeed’s Xadow modules to build the hardware circuit. The reason why we choose Xadow because that Xadow modules are small enough and have flexable connection using FFC which makes them easily still into the fan. What’ more, they are cheap and stable.
The modules that we chose are:
The module is a microcontroller board based on the controller ATmega32U4 with 32k flash. Board can be powered either from the USB connection or a Lithium battery(80mA output current). And the board can charge for the Lithium battery through the USB port. The USB port on the board can be also used for upload program.When you upload program to the Xadow Main Board as you do with other Arduino boards, please select "Seeeduino Xadow" from the Tools > Board menu. It is a indispensable part in the Xadow Kit.
Xadow - 3-Axis Accelerometer
This is a high resolution digital accelerometer with large ±16g measurement range through IIC interface, suit for monitor the motion state. With this module, you can easily add monitoring movements function in your design, Such as arms, legs shaking. Here, we use it to read gesture and movements.
Xadow - Vibration Motor
This small motor can vibrate like your phone. When using it, You only need to power the module and then send the "vibration" command. In fact, The "vibration" command is setting control pins to high level. I like this module because it can creat a short-term shock to prompt me whether one operation was successful.
Grove - Infrared Emitter
This module is used to transmit infrared signals through an infrared LED, while there is an infrared receiver to get the signal on the other side. the infrared emitter can transmit signals reliable up to 10 meters. We use this module to emitter our command to those household appliances.
Grove – Infrared Receiver
This module is used to receive infrared signals and also used for remote control detection, There is an IR detector on the Infrared Receiver which is used to get the infrared light emitted by the infrared Emitter. The IR detector have a demodulator inside that looks for modulated IR at 38 KHz. We need this module because we need to read the infrared signal from the remote control of your household appliances, and then kept it in program.
Xadow – Breakout
This module is used for connecting the grove products to the Xadow interface. Because we used the Grove - Infrared Emitter module, we need this to make the connection.
2. Hardware Connection
The connection of hardware is simple but need your attention. Firstly, we connect the Main Board, Vibration Motor, 3-Axis Accelerometer and Breakout these four modules via FPC wire, you should know that every Xadow modules has direction, you need to keep the four modules int the same direction.That means, head to tail and tail to head. As shown in the following image
Pay attention to the order of connection otherwise it will be difficult to put these modules into the fan. Below the proper order:
Then, connect the Grove – Infrared Emitter to the Xadow – Breakout. Because we will use a digital pin to send IR signal, we connect these two modules with a 4-wire cable and use the Serial Port of Breakout. Below is the complete connection:
3. Programing
You will start the work on software after you finish the hardware connection. The software task contains 4 step as follow
3.1. Download code
Firstly, please download the source code here, then unpack it to anywhere, it’s not a library but a sketchbook. Click here to get more details on how to use Sketchbook. Open Arduino IDE, File –> Preference, write down the path of the sketchbook in Sketchbook location
Click OK, and re-open Arduino IDE, check if the sketchbook location set OK. If so, click File -> Sketchbook -> MagicFeatherFan
Open the code:
Please pay attention to the following code in Sketch. It records the IR raw data of your household appliances. You need to replace it with yours and we will show you how to get it in following steps.
3.2. Get IR Raw Data
The best option is using an Arduino Uno board, other Arduino board would be OK too! Please click File -> Sketchbook -> Libraries -> IRSendRev -> revTest
Once open, it will look like this:
Then, you need to connect the Grove – Infrared Receiver to your Arduino board, Be careful that the RX pin of this module should connect the analog pin of Arduino board. In code, it is A4, the connection is like below:
Connect your Arduino board to PC, upload the code to Arduino. If you are not familiar with this, click here to get more information. Then open the Serial Monitor of Arduino IDE, the Serial baud rate should be 38400.
Now, take out of your remote control (e.g., air conditioning remote control), and press the key that you want to store (e.g., Power Key) toward the IR receiver. You will find the IR raw data in Serial monitor as follow. Record and store these raw data in some place, and press other key that you want to add and do the same operation as just now.
3.3. Modify Sketch
Now, you have got the IR raw data of your household appliance. Modify the array data IRRawData[][IR_STRUCT_LEN] in sketch with them, just as below.
Pay attention to the gesture described in Sketch--so far supporting 15 kinds of gesture, as follows:
These gesture are easy to remember, and they will be mapped to the IR raw data in IRRawData[][IR_STRUCT_LEN]. By default, gesture 0 (upward) will be correspond with IRRawData[0], and so on.
- Gesture 0 [upward] —— IRRawData[0]
- Gesture 1 [downward] —— IRRawData[1]
- Gesture 2 [aleft] —— IRRawData[2]
- Etc.
Of course, you can modify the mapping relation in code, it is here:
3.4. Upload Code
The next step is connecting the Xadow – Main Board to your PC, and upload the code to Xadow – Main Board. If you are not familiar with this, click here to get more information.
Open Tools -> Board -> Seeeduino Xadow.
If you can’t find Seeeduino Xadow in your Arduino IDE, click here if get help.
Then choose the right Serial port number, click Upload, and we finish the code uploading.
4. Print the Shell
Firstly, we need to download the Shell file here.
Enclosure model file(stl): MISSING LINK ?
Enclosure 3D printing file(3xg):MISSING LINK ?
Download the Enclosure 3D printing file and import it to the SD card, then you can printing the Enclosure with the SD card.
5. Installation
Now that all our materials are ready, we can assemble them together:
6. Test and Play
It’s time to test your magic feather fan now.
- Shake the fan to wake up the function of gesture recognition, you will feel the vibration after waking it up.
- Draw your gesture in the air, keep the speed not too slow nor too fast. Another vibration will occur when you stop drawing.
- Point to the appliance that you want to control, it will take your order according to your gesture.
How to improve it ?
We now have a feather fan with gesture recognition. You might find it too simple and want to make a more cool and complex one. The Xadow Kit has dozens of modules, this will help you to improve your feather fan. Here is the detailed design of the feather fan which can help you to build your own one.
1. Software Design
Software design is time-consuming, it is not easy to achieve gesture recognition on such hardware platform, you need to care about the memory and speed both. Here, we will show you the whole design of software, which includes three part as follow
1.1. Algorithm
The gesture recognition algorithm that we use is simple but efficient. We uploaded it to Github, and you can find it here. In order to improve the recognition effect, we have defined 16 kinds of gesture movements as shown in the graph, these all are very simple gesture which make it easy to remember. You can define one of the gesture movements to the electrical appliance that you want to control remotely.
The idea behind the algorithm is to calculate the speed direction according to the direction of acceleration. First, we get the acceleration value array by periodic sampling, and then calculate the speed array by integrating a discrete sequence of the acceleration array. Finally, We will get the direction of movement by analyzing the speed array. The whole flow is as below.
For more information, please review the source code in gesture library and feel free to contribute to its improvement!
1.2.IR Emmitter
We use the native IRSendRev library but made some changes. Because PWM is needed in the library when we launch the infrared signal, while digital pin 0 and digital pin 1 in Serial port do not support PWM, we have to realize software PWM for them. You can compare the modified library with the native version to check how to realize software PWM. And you will find the key place is in IRSendRev::sendRaw function, just as below:
1.3. Control Flow
The control flow of the magic feather fan is concise, as you can see from the chart below (use it as reference to understand the whole process of architecture):
2. Structure Design
You can design your own structure, but I included a design flow of feather fan below for your convenience.
Start by measuring the size of the Xadow module, based on these dimensions make the 3d model of the enclosure:
When modeling is completed, save the format: stl, and then open MakerWare, import the Model file, Ensure the file format is:
Adjust the model position, ensure the model in the print range. Then adjust the print parameters:
Below are some parameters:
- Infell: 100%,
- Number of shells: 1
- Layer height: 0.20mm
- Extruder: 205°C
- Speed while extruding: 100mm/s
- Speed while traveling: 120mm/s
Once those parameters are set, you can generate your 3D-printing file.
ye xiaobo
Comments