Let’s now assemble the hardware for this project. We will do so in two parts. We will first connect the different components like the WiFi module to the Arduino board, and then we will connect the powerswitch tail.
The hardware connections for the first part are actually quite simple: we just have to connect the WiFi module. First, connect the Arduino Uno +5V pin to the red rail on the breadboard, and the ground pin to the blue rail.
Now, the WiFi module. First, connect the IRQ pin of the CC3000 board to pin number 3 of the Arduino board, VBAT to pin 5, and CS to pin 10. Then, you need to connect the SPI pins to the Arduino board: MOSI, MISO, and CLK go to pins 11,12, and 13, respectively. Finally, take care of the power supply: Vin goes to the Arduino 5V (red power rail), and GND to GND (blue power rail).
This is a schematic of the project, without the connections to the powerswitch tail:
Then, you need to connect the Arduino board to the powerswitch tail. Simply connect the +In pin of the powerswitch to Arduino pin 8, and the two remaining pins of the powerswitch to the Arduino ground.
The following picture is an overview of the whole project fully assembled:
Finally, connect the male power plug to the mains elecricity, the device you want to control to the female power plug, and finally the Arduino board to your computer using an USB cable.
This is a picture of the assembled project, with the device to be controlled (a standard 30W desk lamp) connected to the switch: