Build It


Alert System with Photo Resistor, Buzzer and Laser (Concept)
What we want to achieve Using an Arduino - we are using a Nano V3.0 compatible board - we want to demonstrate on how an alert system could be build, where an alert is triggered if an object interrupts the path of light. Think of a customer entering a shop, an intruder entering an area. You could reverse the example and trigger an alarm when the light path is restored - for example to detect if an object has been removed. Note This tip uses a laser as a directed and focus light source. While we are only using a 650nm 5mW laser, please be always careful not to point the laser at persons, animals. Our code can run in two modes 1) It will continuously sound alarm once it has been triggered. Only way to stop alert is reset the Arduino 2) It will sound alert when light path is lost and will stop sounding alert once light path is restored. Requirements Arduino (compatible) development board - we used the Arduino Nano compatible board (see here) Laser Transmitter Module - KY-008 (see here) Passive Buzzer Module - KY-006 (see here) Photo-resistor Module - KY-018 (see here) Arduino IDE (download here) Restrictions This tip is focused on using the Arduino IDE How to Wiring KY-006 Arduino Pin S D4 Pin (middle) NOT USED Pin - GND KY-018 Arduino Pin S A0 Pin + VCC Pin - GND Code //// Photo Resistor Module KY-018 and Passive Buzzer Module KY-006 for Arduino// 20 January 2020 // Author: dante@serveronthemove.com.au//// Hardware:// Arduino// Photo Resistor Module KY-018// Passive Buzzer Module KY-006//// Wiring:// KY-018 -> Arduino// S -> A0// + (middle) -> VCC 3.3V or 5V// - (GND) -> GND//// KY-006 -> Arduino// S -> D4// (middle) -> NOT USED// - (GND) -> GND//// Purpose:// Sound alert when photo resistor is no longer getting light.// The code supports to modes controlled by "TriggerModeOnce"// triggerModeOnce = true; // will sound alert once light source is lost and will continue to sound even if light source is restorted (Intruder alert). To reset, push reset button// triggerModeOnce = false; // will sound alert only when light source is lost. When lught source is restored, sound stops (visitor entered shop)//// Hardware configint photoModule = A0; // S Pin of Photo Resistor Module KY-021 on Arduino A0int buzzerModule = 4; // S Pin of Passive Buzzer Module KY-006 on Arduino D4// Software configboolean triggerModeOnce = true; // will sound alert once light source is lost and will continue to sound even if light source is restorted (Intruder alert). To reset, push reset buttonboolean photoTriggered = false; // indicator if photoresistor lost light sourceint triggerThreshold = 150; // threshold for alert trigger. Anything beyond this value coming from Photoresistor will trigger alert// setup PINsvoid setup() { pinMode(photoModule, INPUT); pinMode(buzzerModule, OUTPUT); }void loop() { // sound alert if // 1) threshold is exceeded - or - // 2) triggerModeOnce is alert and has been triggered before if ((analogRead(photoModule) > triggerThreshold) || (photoTriggered && triggerModeOnce)) { photoTriggered = true; // mark trigger // reset buzzer digitalWrite(buzzerModule, HIGH); digitalWrite(buzzerModule, LOW); // sound alert with PWM for (int i = 0; i < 80; i++) { // make a sound digitalWrite(buzzerModule, HIGH); // send high signal to buzzer delay(1); // delay 1ms digitalWrite(buzzerModule, LOW); // send low signal to buzzer delay(1); } delay(50); for (int j = 0; j < 100; j++) { //make another sound digitalWrite(buzzerModule, HIGH); delay(2); // delay 2ms digitalWrite(buzzerModule, LOW); delay(2); } delay(100); } else { // make sure is down digitalWrite(buzzerModule, LOW); }}

Mini Reed Switch Module KY-021 on Arduino
What we want to achieve Using an Arduino - we are using a Nano V3.0 compatible board - we want to turn on the on-board LED (LED_BUILTIN) on when no magnetic field is present, simulating the way security switches on doors and windows work: Attached to the door or window frame is a Reed Switch, on the movable part - the door or window - is magnet. In closed position it will be near enough to the reed to close the circuit.When the door - or window - is opened, the reed will return to open position and the Arduino will trigger the LED - or any other operation - to alert of the door being opened. Of course we can use only the Reed Switch, however the module makes it a bit easier. Instead of triggering the LED_BUILTIN, you can trigger an external LED or other output devices, send messages, etc. Note Triggering a LED with the reed switch can be accomplished without the Arduino and we might give a tip on this later. Requirements Arduino (compatible) development board - we used the Arduino Nano compatible board (see here) Our Mini Reed Module KY-021 (see here) Arduino IDE (download here) Restrictions This tip is focused on using the Arduino IDE How to Wiring KY-021 Arduino Pin S D3 Pin + VCC 3.3V - 5V Pin - GND Code ///// Reed Mini Module KY-021 for Arduino// 18 January 2020 // Author: dante@serveronthemove.com.au//// Hardware:// Arduino// Reed Mini Module KY-021//// Wiring:// KY-021 -> Arduino// S -> D3// + (middle) -> VCC 3.3V or 5V// - (GND) -> GND//// Purpose:// A LED will be off and turn on LED_BUILTIN when magentic field is introduced, simulating an alert light when a door is opened.//// Note:// If you find the LED behaviour reversed - start turned on, and turn off when magnetic field is introduced -// you can reverse + and -int reedModule = 3; // S Pin of Reed Module KY-021 on Arduino D3void setup() { pinMode (reedModule, INPUT); pinMode (LED_BUILTIN, OUTPUT);}void loop(){ digitalWrite(LED_BUILTIN, digitalRead(reedModule)); // when the magnet is removed , turn LED on}

Nokia 5110 PCD8544 with Arduino - the easy way

Using nodeMCU ESP2866 Boards with Arduino IDE
What we want to achieve We love the nodeMCU ESP8266 boards, especially with Lua. But Lua is not everyone's cup of tea and we want to use NodeMCU straight out of the box with the Arduino IDE to upload sketches. Using a nodeMCU ESP8266 development board and Arduino IDE we will upload a small sketch which will flash the Built-in LED as well as output the available WiFi Access Points. This is the same sketch to test our boards before sending them out to you. Requirements Our nodeMCU ESP8266 development board Arduino IDE Restrictions This tip is focused on Arduino IDE and our nodeMCU ESP8266 How to Connect your NodeMCU to your computer and fire up Arduino IDE In the Arduino IDE - under "Preferences" add as "Additional Boards Manager URL" the URL http://arduino.esp8266.com/stable/package_esp8266com_index.jsonand press OK (twice) Go to Tools -> Board -> Boards Manager Type "ESP8266" in the search field and then install Go To Tools -> Boards and select NodeMCU 1.0 Upload the sketch below Open Serial Monitor to see the WiFi APs found. Observe the Built-in LED Flash Code /* * Test sketch to validate NodeMCU ESP8266 is working * * Server On The Move */ #include "ESP8266WiFi.h" void setup() { Serial.begin(115200); // Enable station mode and - just in case - disconnect from previous Wifi WiFi.mode(WIFI_STA); WiFi.disconnect(); delay(100); Serial.println("Setup complete"); // Set Built-in LED to output pinMode(LED_BUILTIN, OUTPUT); } void loop() { Serial.println("Start Scanning - please stand-by"); int n = WiFi.scanNetworks(); // how many did we find ? Serial.println("Scanning complete"); // nothing found :-( if (n == 0) Serial.println("No Networks found."); else // found something { Serial.print("Networks found: "); Serial.println(n); for (int i = 0; i < n; ++i) { // Show each SSID and its RSSI (quality of network). // Mark encrypted networks with a "*" Serial.print(i + 1); Serial.print(": "); Serial.print(WiFi.SSID(i)); Serial.print(" ("); Serial.print(WiFi.RSSI(i)); Serial.print(")"); Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*"); delay(10); } } Serial.println("Performing Flash of BUILTIN LED"); // Do LED blink digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(250); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(150); // wait for a second digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(250); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(150); // wait for a second digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(500); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW // Wait a bit before scanning again delay(5000); }

Sensor Array using Particle Cloud with RedBear Duo

nodeMCU ESP8266 w Lua - Moisture Sensor, Display and extended Breadboard

Nokia 5110 PCD8544 with nodeMCU ESP8266 using Lua and u8g2
