The triggering value for light intensity can also be definedin the source code. If the intensity of light goes below the predefinedvalue, the relay connected through CON2 is driven by port pin PD7 of IC3 to switch on the bulb and the LCD shows the message ‘bulb on.’

Fig. 4: Simplifiedconnection diagram
Fig. 4: Simplifiedconnection diagram
Fig. 5: html page in the source code
Fig. 5: html page in the source code

The power to the whole system is provided using a 12V adaptor. Regulator IC1 provides a 5V output, which is further regulated by IC2 to 3.3 V.

Software
The program is written in ‘C’ language. It is compiled and programmed into the target device using WinAVR. The html page embedded in the source code can be accessed from a remote place to findout the readings of the temperature and light sensors. The section of the program definingthe html page is shown in Fig. 5.

To access the system, you have to change the mac address and IP address corresponding to your network arrangement in the line mentioned below in the source code:
[stextbox id=”grey”]static uint8_t mymac[6] = {0x54,0x90,
0x58,0x10,0x65,0x77};
static uint8_t myip[4] =
{192,168,2,248};[/stextbox]

DA5_part-list

The source code is compiled and programmed using WinAVR following the below mentioned steps:
1. Install WinAVR
2. Connect the programmer and check the COM port allotted to the device
3. Change the COM port in the make fileprovided together with the source code
4. Open command prompt and go to the directory where the program is saved
5. Type ‘make clean’ and press ‘enter’
6. Then type ‘make all’ and press ‘enter’
7. Finally, to program the microcontroller, type ‘make program’ after connecting the programmer to the target board

Fig. 6: First layer of the actual-size, double-side PCB
Fig. 6: First layer of the actual-size, double-side PCB
Fig. 7: Second layer of the actual-size, double-side PCB
Fig. 7: Second layer of the actual-size, double-side PCB
Fig. 8: Component layout for the PCBs in Figs 6 and 7
Fig. 8: Component layout for the PCBs in Figs 6 and 7

Download PCB and Component Layout PDFs: click here

Download Source Code: click here

Construction and testing
Both the layers of an actual-size, double-side PCB are shown in Figs 6 and 7 while the component layout is shown in Fig. 8. Assemble the circuit on a PCB as it saves time and minimises assembly errors. Carefully assemble the components and double-check for any overlooked error.For testing the circuit, refer the test-point table and verify the voltages. To test the functionality of the overall system, proceed as follows:

1. Connect the system to your computer using Ethernet cable
2. Give your system IP address 10.0.0.xx., where ‘xx’ should be less than 255
3. Click subnet mask. It will automatically change to 255.0.0.0
4. Change the IP in the source code, say, to 10.0.0.15 (different from the one provided to your computer)
5. Compile and burn the code in the target device
6. Open command prompt and ping 10.0.0.15. If it shows no packet lost, your computer is communicating to the automation system.
7. Now open any Internet browser and write 10.0.0.15 in the url tab. It opens the webpage that is embedded in the source code of the microcontroller with real-time readings from the temperature and light sensors.


The author is a B.Tech final year student of electronics and communication at Lovely Professional University

SHARE YOUR THOUGHTS & COMMENTS

Please enter your comment!
Please enter your name here