@plantpark
2014-07-27T03:42:34.000000Z
字数 4076
阅读 3235
原文链接 作者:nodcah 翻译:plantpark
arduino 无线

这个项目使用一个simple RF link无线通讯套件和两个Arduino做成的可以从90英寸远的地方进行点火。已经厌倦了绕来绕去电线的我,希望能有些突破。so 无线点火器诞生了,不仅更加安全,而且看着非常酷呢。它不仅可以用来点爆竹,模型火箭,还有更大的想象空间。
申明:制作和使用点火器时一定要注意安全,对因此造成的安全事故,本人不承担任何责任。


| 元件 | 供应商 | 价格 |
|---|---|---|
| Arduino Uno REV 3 x2 | Sparkfun buying guide, Radioshack | $50-60 |
| RF Link Transmitter - 434MHz | Sparkfun/Sparkfun | $9 |
| 外壳 x2 | Sparkfun | $7-12 |
| 拨动开关 | Sparkfun | $3-5.50 |
| 单刀双掷滑动开关 x2 | Sparkfun | $.75-4 |
| 喇叭(可选) | Sparkfun | $2-4 |
| 点火器 | Amazon | $6 |
| LEDs | Sparkfun | $1-5.50 |
| 5V 继电器 | Sparkfun | $2-5 |
| 电阻包 | Sparkfun | |
| 8针插座 | Sparkfun | $1-2 |
| 总计 | ~$85-130 |

根据下面照片中的电路原理图搭建电路。
电路设计成,当发射端发射信号后,触发器点火前会五秒倒计时
注意:我发现,让点火器正常工作的电线尺寸要比跳线甚至面包板线粗一些。所以,用鳄鱼夹直接将点火器的接头连接好是非常有必要的。

我使用的点火器是为遥控汽车点燃油气混合物而设计的。在1.5V下即可正常工作,炙热的内芯开始燃烧。提供一种类似硝化棉的引火材料(可以在低温下点燃,并能燃烧产生高温)或者在点火器内芯处放一个很小的保险丝是非常必要的。
一个AA电池不足以让点火器正常运行,所以,我制作了一个电池盒可以让两个电池并联。然后将用鳄鱼夹链接点火器。
电池盒:
1.)将街头一侧的弹簧取下
2.)将弹簧焊接在对面,这样两个弹簧就在电池盒的同一侧了。
3.)确保电池盒两侧是接通的,然后分别从两侧焊接一根线出来
4.)作品最终的形态最有有显示
鳄鱼夹:
1.)将一个大鳄鱼夹的两侧砸平
2.)用电钻在鳄鱼夹的一侧打直径15/64"的孔
3.)将点火器拧到这个孔里并用电烙铁在高温(我用的时400℃)下焊接(或者用尺寸正好1/4 x 28的螺丝)
4.)将两根线分别缠到鳄鱼夹的手柄上
5.)将一根线焊接到点火器一头,另一根接到中间的位置
6.)最终效果如上图所示

首先,钻几个小孔,然后将元件与边缘大小相匹配。如果使用扬声器,请多钻几个孔布成矩阵。
为将盒子紧固,我制作了一个适应arduino的小外壳。我同样希望重复使用接收器和发射器,所以我把它们放在如图所示的IC插座。
I used some foam I cut to hold the arduino in place, but standoffs and screws would work too.
我用了些海绵将arduino固定到位,同样支撑和螺丝也能起作用。

这个项目中所有涉及的代码均是围绕一个叫VirtualWire的arduino库实现的。这个库将廉价无线模块的功能发挥到了极限。
2)根据Arduino IDE的配置,找到sketchbook文件夹的位置
3)看是否有“libraries”的文件夹,若没有则新建一个,然后将VirtualWire放在文件夹内。
4)打开Arduino软件,这样VirtualWire库安装完成。

接收端代码
// Receiver by Noah DC// This code is built around the VirualWire library which// can be found here: http://www.airspayce.com/mikem/arduino/// Visit my instructable for the wiring, explaination, etc.// http://www.instructables.com/id/The-Reusable-and-Wireless-Igniter/const int recieverPin = 2; //to reciever moduleconst int ignitionPin = 3; //to igniterconst int activeIndicatorPin = 5; //to green LEDconst int inactiveIndicatorPin = 6; //to red LEDconst int buzzerPin = 4; //to the buzzer#include <VirtualWire.h>boolean liftOff= false;void setup(){Serial.begin(9600); //for debuggingpinMode(activeIndicatorPin, OUTPUT);pinMode(inactiveIndicatorPin, OUTPUT);pinMode(ignitionPin, OUTPUT);vw_set_ptt_inverted(true); //normal setup stuffvw_setup(2000);vw_set_rx_pin(recieverPin);vw_rx_start();}void loop(){while(liftOff == false){digitalWrite(activeIndicatorPin, HIGH); //shows that igniter hasn't been used yetuint8_t buf[VW_MAX_MESSAGE_LEN];uint8_t buflen = VW_MAX_MESSAGE_LEN;if (vw_get_message(buf, &buflen)) {Serial.print("Got: ");Serial.print(buf[0], DEC); //only one byte in the array (it should be 97)Serial.println(" ");}if (buf[0] == 97){ //checks if the letter "a" is recieved (ASCII number is 97)liftOff = ignition();}}}int ignition(){tone(buzzerPin, 500, 300); //5 second countdowndelay(1000); //it's not necessary, and can be removedtone(buzzerPin, 500, 300); //4 (I relize it's not exactly a second)delay(1000);tone(buzzerPin, 500, 300); //3delay(1000);tone(buzzerPin, 500, 300); //2delay(1000);tone(buzzerPin, 500, 300); //1delay(500);//ignition!!digitalWrite(ignitionPin, HIGH);delay(2000);digitalWrite(ignitionPin, LOW);digitalWrite(activeIndicatorPin,LOW);digitalWrite(inactiveIndicatorPin,HIGH); //shows that igniter has been usedreturn true; //prevents other ignitions for safety purposes}
发射端代码
// Transmitter by Noah DC// This code is built around the VirualWire library which// can be found here: http://www.airspayce.com/mikem/arduino/// Visit my instructable for the wiring, explaination, etc.// http://www.instructables.com/id/The-Reusable-and-Wireless-Igniter/const int transmitPin = 2; //pin to the transitter moduleconst int buttonPin = 3; //pin to ignition buttonconst int armedPin = 4; //pin for indicator LED#include <VirtualWire.h>void setup() {pinMode(armedPin, OUTPUT);digitalWrite(armedPin, HIGH); //shows that igniter is armedvw_set_ptt_inverted(true); //setup stuffvw_setup(2000);vw_set_tx_pin(transmitPin);}void loop() {char *msg = "a"; //going to send the char "a"if (digitalRead(buttonPin) == 1) {digitalWrite(13, HIGH); //blink LED to show it's workingvw_send((uint8_t*)msg, 1); //sends the charvw_wait_tx(); //wait until the char is sentdigitalWrite(13, LOW);delay(500);}}


终于,一个无线点火器诞生了,除了点爆竹外,还有更多有意思的应用值得你去发现哦~~