Demand programming rensignements for a big project

Hello everyone,

I have to prepare a new school project and I chose to realize a home automation system based on Arduino and assisted by a PC.
The Arduino Mega receive information from the various sensors (Hall, PT100, another Arduino via RX / TX, temperature, etc.) should be the basis of the program as ordered (the PC) or GSM Shield should realize some operations. It will also realize some code automatically according to data received from the sensors.
The pc would be for the sending of information via a php page or application on android.
The PC is also responsible heberger the stream of IP camera and make diagram temperature of the house etc..

The heart of the facility would see a two arduino mega communicating together.

My question is: how should we realize such a big project? What should the code look like?
I have already made ??multiple small programs but in this case it would have to know the program manage multiple sensors at the same time is to say that if he enters a loop of operations for an N sensor 1 must be able to out of the loop or accumulate requested by a sensor N ° 2 spots.

I do not know if I'm clear enough, but for such a big project or full operations could be carried out I have trouble imagining the structure of a code as big

Would you give me programming tips or code examples of big project to me?

in advance thank you all !

PS: Sorry for my bad english

Start with one small part, like a menu and one sensor. When that Rev. 1 works, save it as a Rev.2 file of source code. Make small changes and confirm each program. Keep notes on successful Rev. versions. Make incremental changes and improve the functions by many revisions of the source code. When a probelm happens, go back to an earlier Revision that works.

Your whole project can be done using 1 uno no need from the liast civen for any more than that.

Topics to study

  1. blink without delay,

  2. polling

  3. FSM (finite state machines).

Mark

Thanks for your answers

@ ambiLobe : but when you create some Rev, how do you structure your code ? do you add some if/else/elseif or other loop ?

@ Mark : Yes true my project can be done with one uno but i need more digital output for control some relay like a real domotic installation , and for that the Mega is the better option i think.
I look for your 3 topics to study :slight_smile:

Try this...

void loop {

  //Read sensor A
  ...code...
  //Do what needs to be done based on input (if...else, switch, etc...)
  ...code...

  //Read sensor B
  ...code...
  //Do what needs to be done based on input (if...else, switch, etc...)
  ...code...

  // keep repeating above until each of your sensors is read and handled appropriately

}

AmbiLobe gave good advice too... do "sensor A" first until it works just like you want, save and start new version adding "sensor B" until it works just like you want, etc.

Start with the easy ones to gain momentum and so you don't get stalled on a tough problem and run out of time to finish your project. If something goes wrong on the harder sensors to implement, worst case is at least you have a version with a few sensors that work and work very well and you can turn that working project in instead of something incomplete and full of stuff that doesn't work right.

Also, research the "HC595" chip. For example, using this IC I made a custom circuit board that allows me to use an LCD display with only 3 digital pins instead of the normal SIX that it would take without it. These ICs can be daisy-chained to theoretically allow infinite digital pins on an UNO.

sharlihe:
The Arduino Mega receive information from the various sensors (Hall, PT100, another Arduino via RX / TX, temperature, etc.)
The heart of the facility would see a two arduino mega communicating together.

The PT100 would be a bad choice for this. You would be far better off using DS18B20s.

Using a Mega is probably wise but I can't see why you would need two for a this sort of thing. You might use a second Arduino for some sort slave display, or cosmetic thing, in which case a Uno should suffice.

My question is: how should we realize such a big project?

By doing it in small well-tested stages.