copy a file from server to arduino for classroom automation

Hi! I'm new to arduino and I am working on a project that would control the lights of a classroom using arduino. The arduino will access the classroom schedules from the server, then the schedules will then be used as inputs for the arduino module. If the module dectects that there is a class schedule in that particular room then the module will turn on the lights and AC unit of the classroom. Can anyone help me on this? I have to finish this project by January 2014.

I hope someone can help me with this.... =( Thanks!

More details would help - how will you connect to the server? How many classrooms are there? How many does an arduino control?

That said, I assume the classroom schedule is held on a web server, so you'll need a way to talk to it, e.g. ethernet shield or wifi shield. The Arduino can act as a client and use GET requests to find out what the classroom status should be.

At its simplest, the arduino can pass a hard coded classroom id in the GET request and have the server figure out, based on time of day, whether the AC or lights should be on. Presumably, the AC should come on a little early to be effective.

The lights and A/C will need to be switched using external hardware - relays, or something like the powerswitch tail. The latter is preferable if you don't have experience using mains voltage.

If desired, the arduino can take on more responsibility - pull down the schedule periodically and then do the time calcs for itself to determine what it should turn on/off and when. A RTC might be useful in this scenario. A single arduino might control multiple classrooms too.

Hi wildbilll!

I am only using 2 classrooms as subject of my project. I am still trying to figure out what to use to communicate with the server, either a wifi shield or ethernet shield, or are there any ways aside from these two? What do you mean by, making the arduino pass a hard coded classroom ID in the get request and have the server figure it out? Can you explain it to me?

Thanks! :~

or are there any ways aside from these two?

To talk to a web server? No.

What do you mean by, making the arduino pass a hard coded classroom ID in the get request and have the server figure it out? Can you explain it to me?

How are you planning to tell the server which classroom you want the schedule for? Either the Arduino needs to figure which room it is in (I can't think of an easy way to do this) OR you have to tell it, so it can tell the server, which room it is in.

I mean, the server will just load and update the schedules to the arduino and arduino will be the one to process the loaded schedules and will then control the lights and AC unit.

I mean, the server will just load and update the schedules to the arduino

No, it won't. A server can not push data to a client. A client can only pull data from a server.

Do you have an Ethernet shield to start testing code?

Ultimately you will need some way to know which physical Arduino is in which classroom. I would have thought that a unique ID/serial number written to EEPROM would be a good way to achieve that.

If it was me, I'd use a database on the server to hold the relationship between Arduinos and classrooms, and also to hold the schedule information associated with each classroom. I'd also put the scheduling smarts on the PC and have that send unsolicited commands to each Arduino at the start and end of each session and just use the Arduino as a remote switch.

Actually, if it was me I wouldn't be trying to schedule lights and AC in the first place and I'd just get the teacher/lecturer to turn them on and off as required, but that's another matter.

wildbill: The lights and A/C will need to be switched using external hardware - relays, or something like the powerswitch tail. The latter is preferable if you don't have experience using mains voltage.

if you don't have experience using mains voltage, you simply forget this project in its entirety. A "powerswitch tail" is not going to "cut it" controlling lights and air conditioning.

As regards air conditioning, many nowadays have an infra-red remote control, so the interface would be an IR sender on the Arduino.

Obviously, each Arduino would "know" the identity of the room to which it is allocated. You could store it in EEPROM, but it is just as straightforward to compile it into the program individually.

And it is going to be much easier - and more adaptable - for the server to determine the times for each room, and the Arduinos can simply poll a simple variable in a file location.

The thing about air conditioning is the need to have it switched on between half an hour and an hour before the room is occupied.

PaulS:

I mean, the server will just load and update the schedules to the arduino

No, it won't. A server can not push data to a client. A client can only pull data from a server.

A server can if the socket is already established...

Basically your arduino's can connect to a server and wait until instructions are sent... i'm more curious as to where the data is stored and it's own downtime, the alternative is an external server, using GET or POST to deliver information back and forth over http

Regarding the aircon... that would be an issue.

If no remote or the ability to issue commands via IR does not exist there's another way which will do the job.

http://hackaday.com/2013/10/06/remote-servo-controlled-lightswitch/

The main advantage is that the switch is still accessible by humans, no risk of electricution (unless you work on it live).

OK, there is an application in our school which called Electronic school Management System. One of its features is to produce a file containing the class schedules of a particular classroom. Now, how would I use this file to be converted to something that can be read/processed by my arduino?

One of its features is to produce a file

Produce it where?

Now, how would I use this file to be converted to something that can be read/processed by my arduino?

That depends on where the file is stored, and whether some application is pushing data from the file to the Arduino, whether the Arduino is pulling information, and/or whether the Arduino is supposed to have direct access to the file (on an SD card) and is expected to read, parse, and use the data in the file.

ianjames: how would I use this file to be converted to something that can be read/processed by my arduino?

If you want to use the file, then write an application (I would suggest running it on a PC somewhere that has direct visibility of the file) which monitors the file for updates, parses the file contents and extracts the class schedules from it, locates the parts of the schedule relevant to your control system, and does whatever is needed to make your system follow that schedule.

It would IMO be worth looking for any other mechanisms available to you for retrieving the schedule - a shared text file is a pretty ugly way to do it.

I think that as far as the aircon control is concerned what you'd want to implement is essentially a programmable thermostat where the program is updated automatically from the schedule. I'm sure you're doing this project for the challenge of doing it, but if that wasn't the case then it would be more sensible to just fit a programmable stat which already has this capability. It will be simpler, safer, easier to use, and already have all the status displays and manual override and so on built in. It's probably also not going to cost much more than an Arduino-based solution by the time you figure in all the networking hardware.