I ordered a small strobe light more than a month ago from china, but it wasn’t delivered in time, so I made one from a LED light I had at home.
First, I wired this LED light through a NPN transistor. It couldn’t be wired directly to Arduino because it requires higher current than Arduino can provide. I’ve also wired a 10K Potentiometer for tuning the frequency of blinking. Wiring diagram
Resistor wired from pin 2 is 1K Ohm and the pulldown resistor connecting transistor to the ground is 10K Ohm.
Wiring
Programming everything was as simple turning pin on and off with delays in between linked to potentiometer. At higher frequencies I noticed that light was actually lit longer than it was off so the effect wasn’t as good as I expected it to be.
I had to adjust the delay before light turns on again to be longer at higher frequencies, but stay about the same at higher. I drew a graph time on-time off to represent this and figured out I could shift and stretch function y = -1/x to form the same line. The results were much better then.
Graph
Here is the code for Arduino.
C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
intpotPin=2;// input pin for the potentiometer
intledPin=2;// pin for the LED
intval=0;
intonTime=0;
intoffTime=0;
voidsetup(){
pinMode(ledPin,OUTPUT);// declare the ledPin as an OUTPUT
}
voidloop(){
val=analogRead(potPin);// read the value from the potentiometer (10k Ohm) (approximately between 0 and 1000)
onTime=val;
offTime=(-2000000/(onTime+1000))+2000;
onTime=onTime/4;//
offTime=offTime/4;// Intervals longer than 250ms were not useful for application, also makes potentiometer less sensible, so I could fine tune desired frequencies.
if(onTime>12){//keeps light off if potentiometer set to min
digitalWrite(ledPin,HIGH);}
delay(onTime);// how long the LED stays On
if(onTime<250){//keeps light on when potentiometer set to max
Last year I made Room automation with Raspberry Pi and few Arduinos for switching lights and air conditioner on and off using my phone. It required lots of components for accomplishing a simple task. The reason was that Arduino itself cannot connect to wifi and NRF24L01+ module doesn’t support TCP/IP protocol, so I needed Raspberry Pi for wifi connection. Also using new Raspberry Pi for each light switch is just too expensive. This time I used WeMos ESP8266.
ESP866 is an inexpensive Wifi Module for Arduino that supports 802.11 b/g/n protocols and it can also run Arduino code. There are multiple versions of this SOC. Some require serial to USB adapter for programming and some have micro USB port. They also vary by amount of GPIO ports and memory they have.
List of parts that I also used for this project:
WeMos D1 ESP8266
Relay module
MB102 Breadboard Power Supply Module
Old notebooks power adapter
For assembly I connected notebook’s PSU to MB102 PSU module, MB102 to ESP8266 with USB cable and GPIO ports 0, 2 and ground on ESP8266 to Relay module.
ESP8266 WeMos
I modified ESP8266 library example code and uploaded it on the WeMos ESP8266:
// when the function returns and 'client' object is detroyed
}
Module automatically connects to wifi when powered and receives an IP address from router (192.168.1.45 for example). It’s IP may change every time module disconnects from wifi, so I assigned it static IP address on my router.
You can switch GPIO on by sending HTML request to “http://[ESP8266s ip address]/gpio/0” and to turn it off “~/gpio/1”. This is done simply by visiting url in a web browser.
Disadvantage of the code from libraries example is that you can’t tell whether GPIO is on or off. I modified it so that html response includes info about its status when you visit ~/status.
Turning the air conditioner on by typing http://192.168.1.45/gpio/0 into a browser and making sure that it’s on or off by visiting http://192.168.1.45/status it’s not very practical, so I made a simple web interface and added it to my homes dashboard webpage.
It displays a button with text “Turn on” or “Turn off” depending on the GPIOs current status. When you click it, it sends a html request to the module to change its GPIO state.
You can use as many ESP8266 modules as you want and manage them from a centralized web application.
Everything connected
Edit: Someone on Reddit requested code for managing multiple ESP8266s. So here is the code. To add new module, just add its IP address and name in the array.
As the growth of wireless devices is increasing and BYOD trend continues to grow in popularity, a large amount of critical information is transferred over a wireless network. Yet the majority of companies is still using WPA2 Personal security mode. WPA2 Enterprise uses IEEE 802.1X, which offers enterprise-grade authentication.
WPA2 Enterprise offers a lot of benefits, some of which include:
Prevents traffic snooping
Enables enhanced security methods
eliminates the security risk of shared password
While connection using WPA2 Personal is encrypted, everyone connected to the wireless network uses the same password. Thus system administrator can’t monitor who is connected to the network and more importantly, the connection between an access point and each user is encrypted using the same key. So if one user gets compromised and the password gets stolen, intruder is able to snoop all traffic across the wireless network.
Another benefit of using WPA2 Enterprise with RADIUS is that each user can connect with his login credentials on multiple locations. Eduroam is a good example of such network.
RADIUS diagram
Setting up WPA2 Enterprise WiFi on DD-WRT is quite simple. For my setup I used Synology DS716+ and TP-LINK TL-WR1043ND with DD-WRT installed on it.
To set everything up, you need to install RADIUS Server Package on Synology. Then open RADIUS Server and head to Clients tab to add them. Clients are actually wireless access points, not end devices.
RADIUS Server on Synology
That is all you need to do for basic configuration on your Synology. Now you need to access dd-wrt router and go to Wireless -> Wireless Security. For security mode choose WPA2 Enterprise and AES Algorithm. Then enter the IP of your Synology running RADIUS Server and port which is default 1812 if you didn’t change it. And lastly Auth Shared Secret.
DD-WRT
If you configured everything correctly, you should be able to connect to your Wireless network using credentials from your Synology DiskStation. You can add new users in Synology control panel.