Microduino-WiFi Controls LED

From Microduino Wiki
Revision as of 05:36, 30 September 2016 by Fengfeng (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Purpose

This course will show you how to use Microduino to make a device controlling LED lights, which adopts json transmission format by wifi.

Equipment

Module Number Function
Microduino-Core 1 Core board
Microduino-USBTTL 1 Program download
Microduino-WiFi 1 Wireless transmission


  • Other equipment
2
Jumper wire One box
LED light 2 cable
micro usb cable One

Schematic

WifiContorlLEDSchematic.png


Program

wifiConrol

Debugging

Step 1: Build the circuit according to the schematic, just like:

WifiContorlLED1.png


Step 2: Download the code and run Microduino_led_wifi code in Microduino. In this case, if there is still compile error, it should be lack of Adafruit_CC3000: [_03_Microduino_WIFI_CC3000]

After installing the missing library function, it should go well. Before that, please modify user name and code of wifi.

WifiContorlLED1 1.png


If everything goes fine, your IDE serial communication will show IP address such as:

WifiContorlLED2.png

From the picture above, we can see Microduino Wifi connection goes normally.

Step 3: Next, you need to configure your laptop to be a server which can run PHP code. Because, here we use is PHP code.

Windows operating system

  • W-windows
  • A-apache
  • M-mysql
  • P-php

Linux operating system:

  • L-linux
  • A-apache
  • M-mysql
  • P-php

Mac OS:

  • M-Mac OS
  • A-apache
  • M-mysql
  • P-php

Here we use is windows operating system:

Official website: http://www.wampserver.com/en/ Please download and install.

Download address of this site: File:WampServer.rar

During the installation, it will probably give you notices such as the lack of msvcr110.dll. That's because components are missing in your windows system, which please check: [Visual C++ Redistributable for Visual Studio 2012 Update 4], download and install.

WifiContorlLED3.png

msvcr110.dll download address of this site: File:Msvcr110.rar


After installation, you will see the following under your installation directory.

WifiContorlLED4.png

Open your browser and input "localhost"

The picture below shows wampserver installation success:

WifiContorlLED4 1.jpg


Step 4:

Find the file "update_state.php" in your download code folder, then change the IP address of the socket connection to that of Microduino:

WifiContorlLED5.png


Put MicroduinoWiFiControl folder into "www" folder and input the browser website: http://localhost/MicroduinoWiFiControl/robot.html

Display:

WifiContorlLED6.png

Make sure your Microduino is powered on at this time and click the buttons and see what happens to the LED lights.


Step 5: You can use any terminal control besides controlling LED lights, such as your phone:

WifiContorlLED7.png

Input your IP address in your phone to visit webpage interface. If your visit is restricted, it means that you have set limited visit for other computer in LAN during initialized installation of wampserver. Below is the solution: Find the file of httpd.conf in wamp folder, which is in wamp\bin\apache\apache2.4.9\conf

Find statements as follows:

 #   onlineoffline tag - don't remove
 Require local

Replace them to be:

 #   onlineoffline tag - don't remove
 #   Require local
 Require all granted

(Note: Don't delete "Require local“)

Result

You can now control LED lights through a phone or browser.

WifiContorlLED8.png
WifiContorlLED9.png


Video

http://v.youku.com/v_show/id_XODMyNDg4MDgw.html