i'm new into this arduino stuff and I recently bought an Arduino starter kit. I would like to automate my room.
I would like to have Rfid card access, voice controlled light switches, automatic curtains, etc.
My question is: Can I do all these stuff with a single microcontroller, or do I need a single one for every task?
Thank you in advance. I'm from Ecuador by the way.
Microcontrollers are generally limited in how many tasks they can perform "same time". So are any other computing devices , relatively speaking.
Take a look at busses - as in shared communication path between devices, not as a city transport.
Some devices will operate on parallel bus (BCD) , some on serial (I2C, SPI).
Most of the time the limiting factor of a microprocessor is an amount of available memory, and how clever the programmer is.
Good luck with your project.
Vaclav
Can I do all these stuff with a single microcontroller, or do I need a single one for every task?
Yes, you can use 1 controller. The reason more are often used even when the program and memory space are adequate for just one is the wiring delimia ... Multiple remotes feeding into one master collector can minimize wiring to 2-wires or even eliminate wires by using inexpensive wireless nodes.
Microcontrollers are pretty cheap, its usual to put there where they are needed - you have
several different projects there that might each have its own box/unit or could be all in
one unit - the convenience of connecting wires and motors will tell to dictate how things
are placed.
Bringing all the wires to one place does allow more options (voice control for everything,
powersaving when room is empty, etc). You can also share resources (real time clock,
battery etc).
However you might want each unit to do one thing well. So you have the choice and I think
you will get a better idea once you've tackled some of the projects.
Well I would not try to get an Uno to control more that 20 or 30 devices all though it can and statements such as
Microcontrollers are generally limited in how many tasks they can perform "same time".
are just plain pointless much less powerfull processors are used to to many hundreds of things at a time. It all depends on that the "job" is.
and how clever the programmer is.
Its nothing to do being clever its about learning how to do the job the right way. For example NEVER using an interrupt if you can use polling. Look into using FSM's (see the playground).
The hard part of this sort of room automation project is the need to interface with mains voltage systems. Unless you have been trained to do that safely you should stay away from it. It's relatively easy to get something working, but much harder to ensure that it's done safely and won't put you or somebody else encountering it at risk of fire or electrocution. You should look into existing solutions that you can take off the shelf for this part of the problem, such as X10 protocol devices and the PowerSwitch tail.
Automatic curtains are certainly feasible and exactly the sort of thing that Arduino is idea for. I made one using an LDR as a daylight sensor and a small DC motor / gearbox assembly as an actuator, with the whole thing powered by a 12V / 1A wall wart, total hardware cost was around fifty quid.
Voice activation can get more complicated - there is an Easy VR shield which provides voice recognition, but I think you'll find it's pretty fussy in practice. For a more capable voice recognition you might want to use a PC or smart phone, which has far more processing capability and intelligence available.
What you're trying to do is all feasible with Arduino but you've included several quite advanced technologies in your description so don't expect do do the whole thing straight out of the box - it's the sort of thing that you would expect to tackle in several small projects over an extended period.
All of PeterH's comment are correct but tend to apply to the Uno/Mega the Due, Yun, Tres are very different. Take it one step/thing at a time and keep your hands off the mains power!. Of and never use a relay! MosFets are the way.
Thank you all, for your answers, I'm an electronics/ industrial automation engineer student and I'm in second semester. I can't wait until I learn these things in university so I decided to start earlier.
Thanks a lot again.
holmes4:
Its nothing to do being clever its about learning how to do the job the right way. For example NEVER using an interrupt if you can use polling.
Amen to that.
Newbies tend to greatly misunderstand the term "interrupt" and imagine it means something that you use to "interrupt" the present task.
It actually means the very opposite - something you need to do without interrupting the current task - something that will happen as far as possible without the current task realising it!
It may be that an interrupt does something that when the current task is in a position to check on it - a semaphore - will redirect that task in a different manner, but only when it is ready to do so. In the vast majority of circumstances, the matter can wait until the current task examines the situation - polling - and the time it takes to poll the relevant input is generally minimally - if at all - more than it takes to poll a semaphore.