Hello everyone I am new to microcontrollers and electronics in general, and would like to learn how I can control lights within my house via an iOS Application. How would I go about doing this…with the use of an custom arduino board or a pre-built microcontroller. Please understand I really have no idea what to do when it comes to electronics, I know the basics and that is all. I also understand how to program. Any help is appreciated thank you.
Electronic – arduino – Implementing a Microcontroller with an Iphone App to Control household lights
arduinoiphonemicrocontroller
Related Solutions
Arduino IS based on a microcontroller (by atmel) and is basically a breakout board for such microcontroller plus some friendly way to upload a program to it.
It's programmable in c++ so it's quite easy and, as @Michael said, the community is huge. You can use the program on a bare chip without the board if you provide the proper connections, parts etc...
That said i'm a PIC user and i don't really like the bulkiness of arduino (both in terms of price, physical space and memory occupied by the bootloader) and the way its community works.
BUT if you want to program a pic or an avr you need an external not-so-cheap programmer (search for pickit2 or avr dragon...way more than an arduino) and a proper c compiler. Then remember that usb access comes at a price (i.e. writing a program to use it but then you need a way to program the chip in the first place!).
Arduino has everything you need to start FAST and such a program would be nearly trivial with all the libraries, a thing i wouldn't dare to say for a "from scratch" project like yours. Then again, if you want to learn bare embedded programming just grab a micro, buy or build a programmer, download the tools and start by blinking a LED then build from that. I'd advocate for PICs but really it doesn't matter. AVRs have nice open source tools while PICs are slightly cheaper. You'll find hundreds, thousands of discussions on which is best and why they're wrong :P
To answer your questions:
1) The bootloader would be loaded by the developer. 2) Skipped; It's not pre-loaded. 3) Yes, you can use a programmer to load a new program onto the PIC but if you don't include the boot loader then it will be overwritten unless you account for the bootloader or load it on yourself. The hex file you create should start writing to memory after the bootloader's location, and probably needs to be configured to work with the bootloader. The bootloader is provided by Microchip and there are app notes on how to use it. You can also find a compatible programmer on Microchip's website.
One of the reasons for the boot loader is so you don't have to use a programmer. It allows you to connect via USB and load the new hex file without using a programmer.
From the link:
To perform a firmware upgrade first, switch the SW1 to 'A' for bootloader mode and connect it to USB port. Then program the iCP12 with provided firmware (iCP12_xx_Firmware.hex) file using the Microchip USB HID Bootloader application. Disconnect the iCP12 and switch back the SW1 to 'B' for normal operation.
The exe for the HID bootloader application can be found in the iCP12_usbStickPack (software pack) found in the download section from the link you posted (http://www.piccircuit.com/shop/pic-dev-board/119-icp12-usbstick-pic18f2550-io-board.html).
Best Answer
There are several points that come to mind when thinking about the design for this project.
Connecting Arduino to iPhone
There are 2 options for this use bluetooth or have a webserver running on a netduino, so it could be accessed from the web. Here are some tutorials on iPhone and Arduino.
Mains/Line Power and Microcontroller
You are going to need some form of isolation between your control system and the lighting system because they both use different current(lighting if mains then is AC, microcontroller is DC) and different voltages(lighting 240v in the UK(120V in the states, while microcontroller uses ~5v). This could be done with a relay or opto-isolator. A relay is a device that is a mechanical switch which has an electro-magnet that pulls the contact instead of pressing it. Primarily used so you can interface different voltage systems. Such as your lighting system and Arduino.
Processing Software For Microcontroller
This is trivial basically when it receives a command turn an output on, it is also dependent on how you configure your software.
Software For iPhone
This is the next thing you have to decide on. Remember iPhone development can only be done on a mac so maybe the webserver option is a better approach if you don't have a mac. Also could be accessed on any smartphone(not just iPhone).
Overall I think your best approach is using an Arduino because you don't have to have an extensive electronics knowledge to get this project going, and the majority could be plugging a few wires in with this relay shield(just quickly googled that), then writing the software which there might be loads of examples around for what you are wanting todo. If I think of anything else I will add more.