Advertisement

Wi-Fi Witty Primer

This is just an introduction to Wi-Fi Witty (also known as Wi-Fi Witty Cloud Development Board/ESP Witty) — the $6, ESP8266 IoT module from GizWitz (China). Basically, Wi-Fi Witty is a stack of two circuit boards with an ESP-12F, USB connectors, little tactile switches, a photoresistor (LDR), and an RGB LED chip. You just need a USB cable and a suitable compiler to start playing with Wi-Fi Witty; it’s not very easy to get proper documentation, though.

Basic Structure

The Witty board — which runs on a proprietary firmware from GizWitz — comprises two circuit boards. A programming board (lower board) holds a CH340G USB-to-Serial adapter and supporting circuitry (plus flash and reset buttons). The main board (upper board) holds the ESP module, AMS1117-3.3-V voltage regulator, a user button, a chip LED, and an LDR. Plenty of hardware for novices!

Quick Test Code

When powered up from either USB socket, you can see that the RGB LED emits a steady green light. Some modules also pop up a “WOWSTAR_something” (or “AI-THINKER_ something”) SSID. Because Wi-Fi Witty supports the ubiquitous Arduino IDE, you can try the following sketch just to test your module’s basic functionality. Remember, after the installation of the ESP8266 extensions in your Arduino IDE, it’s best to select “WeMos D1-Mini” or “Node MCU 0.9 (ESP-12 Module)” in the “board manager” to ensure a smooth run. The given sketch reads from the LDR (internally connected to A0) to display relevant data on the Serial Monitor window and writes to the RGB LED (internally connected with D8-D6-D7) to make a random RGB light show.

const int LDR = A0;
 const int RED = D8;
 const int GREEN = D6;
 const int BLUE = D7;
 void setup()
 {
 Serial.begin(9600);
 pinMode(LDR, INPUT);
 pinMode(RED, OUTPUT);
 pinMode(GREEN, OUTPUT);
 pinMode(BLUE, OUTPUT);
 }
 void loop()
 {
 Serial.print(“LDR: “);
 Serial.println(analogRead(LDR));
 analogWrite(RED, random(0,1023));
 analogWrite(GREEN, random(0,1023));
 analogWrite(BLUE, random(0,1023));
 delay(500);
 }

Light Sensor Code

The following is a simple sketch to convert Wi-Fi Witty to a light level detection system. Here, the onboard LDR monitors the ambient light level and flashes the red LED (of the RGB LED) in case of a low light level. If the light level is normal, the red LED goes off and the green LED lights up steadily. You can see the light level readings/announcements on the “Serial Monitor” of the Arduino IDE as well.

const int redPin = D8;
 const int greenPin = D6;
 const int bluePin=D7;
 const int ldrPin = A0;

void setup () {
 Serial.begin(9600);
 pinMode(redPin, OUTPUT);
 pinMode(greenPin, OUTPUT);
 pinMode(bluePin, OUTPUT);
 pinMode(ldrPin, INPUT);
 digitalWrite(bluePin,HIGH);
 delay (5000);
 digitalWrite(bluePin,LOW);
 }

void loop() {
 int ldrStatus = analogRead(ldrPin);
 Serial.println(ldrStatus);
 if (ldrStatus <= 100) { // user-defined threshold
 digitalWrite(greenPin, LOW);
 digitalWrite(redPin, HIGH);
 delay(100);
 digitalWrite(redPin, LOW);
 delay(100);
 Serial.println(“LOW LIGHT LEVEL”);
 }
 else {
 digitalWrite(redPin, LOW);
 digitalWrite(greenPin, HIGH);
 delay(100);
 Serial.println(“NORMAL LIGHT LEVEL”);
 }
 }

Going Further

One advantage of Wi-Fi Witty is that after the programming process, the main board (upper board) can operate standalone without the lower board. As you learned, at the core of Wi-Fi Witty is the ESP8266 ESP-12F, which is a compact Wi-Fi SoC. It can be programmed in C by flashing it with Espressif’s SDK or in Lua scripting language using the NodeMCU software development kit. The ESP8266 acts as an access point (AP) and/or a Wi-Fi station, so once it is configured, it acquires an IP address and then we can communicate with it via a web browser or a smartphone/computer (TCP connection).

Surprisingly, by using Wi-Fi Witty, we can build a smart Wi-Fi Light Sensor/Lux Meter with zero external hardware! Here, you can find ideas on the basic usage of the onboard hardware of the ESP Witty Cloud development board. The given example reads the value of onboard LDR and sends it to the ThingSpeak cloud service. It’s also possible to monitor the indoor temperature of your house and send the periodic recordings to ThingSpeak via Wi-Fi. However, for handling such a project, you should have some hardware and software skills as it’s necessary to replace the onboard LDR with an LM35 temperature sensor (see next figure) and prepare codes for Wi-Fi Witty in either Lua Script or C/C++ language.

See the links of two near-similar projects:

IoT Based Temperature Monitoring System

Witty ESP8266 sending data to MySQL Server

Disclaimer: This is not intended to be a detailed, technical article. Instead, it’ll be restricted to the essentials with some links for more details. The links included here are for the purpose of stimulating imagination and creativity, and the information should be used by the site visitor at his or her own risk and responsibility!

2 Comments

Join the conversation!

Error! Please fill all fields.
Looking for the latest from TI?