智能硬件论坛
直播中

fwy丶lucifer

6年用户 19经验值
私信 关注
[经验]

Wiscam Intelligent fan

实验设备
1)arduino R3开发板一块
2)Wiscam视频开发板一块
3)DC motor 一个
4)IC芯片 ULN2003
(5)5V电源
6)杜邦线若干根
基本原理
    Wiscam工作在AP或STA模式,在AP模式下,上位机连接Wiscam的热点;在STA模式下,Wiscam和上位机要连接同一个路由器。Wiscam透传串口与Arduino串口连接,上位机软件发送控制指令到Wiscam,Wiscam通过透传串口将数据传到Arduino,Arduino通过PWM控制DC motord的转速。
硬件连接
把Wiscam直接插到Arduino的母座上(端口完全对接),如图2所示arduino的PIN 9接ULN2003的PIN 1,ULN2003的PIN 16接DC motor其中一PIN,ULN2013的PIN 8接GNG(Arduino)和PIN 9接 VCC(Arduino)。组合之后单独给Wiscam供电即可(5V)。
图片1.png    图片2.png
测试代码
1、上位机软件(源代码)
   1)控制界面
    图片3.png
         (2)上位机的下载地址:https://github.com/RAKWireless/Wiscam-Intelligent-fan.git
1、下位机(Arduino程序
const int analogOutPin = 9; //  模拟输出引脚
int flase = 0;
int sensorValue = 0;
int outputValue = 0;
char rec[7];
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  while (!Serial)
  {
    ;
  }
}
void loop() {
  if (Serial.available() > 0)
  {
    flase = 1;
    for (int i = 0; i < 7; i++)
    {
      rec = Serial.read();
      Serial.print(rec ); // 打印结果到串口监视器
    }
    // 读取模拟量值Pin);
    outputValue = rec[5];
  }
  analogWrite(analogOutPin, outputValue);
  delay(200);
}

更多回帖

×
20
完善资料,
赚取积分