Question
Asked 18th Jun, 2015

How to start programming a microcontroller?

My problem is, where to start? I have searched the web and have found an open source board called Arduino but how to get other electronic components together? What book or tutorial should I do to be able to create a small project?

Most recent answer

Susan Parker
Imperial College London
As Idris Bouchama says, start with an Arduino.
Which one depends on your application complexity, and if you want wireless connectivity.
1 Recommendation

Popular answers (1)

Vladimir A. Kulchitsky
National Academy of Sciences of Belarus
6 Recommendations

All Answers (22)

Vladimir A. Kulchitsky
National Academy of Sciences of Belarus
6 Recommendations
Zeydin Pala
Mus Alparslan University
Introductory Microcontroller Programming and C Programming for Microcontrollers.
I hope you find it useful.
3 Recommendations
Piotr Mateusz Tojza
Gdansk University of Technology
If you want to use a "ready to go" board with a processor and some peripherals, you can check the Galileo. 
3 Recommendations
Susan Parker
Imperial College London
As Vladimir says, a good point to start is with the Arduino system. There is a large range of boards and a choice of processors in 8 bit or 32bit capability.
The real question is what do you want to do?
Is it a simple control application e.g. temperature for wine/beer brewing or some such, or do you want to do someting really fast in real time with multiple control inputs and outputs e.g. control a quadcopter in autonomous flight.? (Not that I sugest the latter as a first project).
Or do you want to have something that is Ethernet/ Internet connected from the get-go? In that case a Raspberry Pi could be a good place to start. It'fs not as bare metal as the Arduino system, but if you want to do home control (for example) from a web page then this is more that sort of thing.
Arduino also has higher function boards with Ethernet, or one can add shields for that, but the overall flavour of the sorts of thing one can do tend towords one or the other ecosystems.
Hope this helps.
3 Recommendations
Parthasarathi Sadhasivam
Thiagarajar College of Engineering
5 Recommendations
Sergio Martino
InnovaPuglia SpA
Your question isn't clear to me.
1) If you are willing to learn how to program a microcontroller you should first identify which one: ARM, DSP, RISC, CISC, etc or the application you have in mind. Then look for the various demoboard each hw supplier offers. Reading the data sheet, the examples and the application note is a great introduction.
2) If you are interested in programming a system based on a microprocessor (not necessarily a microcontroller) then go with arduino, Rasperry and similar.
The main difference is at which level are you interested
bare metal -> got to 1)
system -> goto 2)
The difference is huge.
3 Recommendations
Mian Ahmed Jehanzeb Anwer Noorpuri
Technische Universität Chemnitz
I recommend for a beginner to read C&8051 I-II  by Thomas Schultz. and Embedded C by Michal J Pont. 
4 Recommendations
Susan Parker
Imperial College London
I would very much advise against starting with assembly language if one has no prior programming experience and does not have an electronics hardware background in logic.
Yes, understanding assembler and processor architecture is a great thing to be up to speed on, but this question is "What book or tutorial should I do to be able to create a small project?"  so the books recomended by Parthasarathi or similar are what is needed, along with looking at sites like http://www.adafruit.com/category/17 which show all manner of starter and explorer kits.
First I advise to define what one wants to acheive, i.e. what is the need/end-goal, then it shold be a bit clearer what one might want in order to start towards that acomplishment.
4 Recommendations
Jan Haase
Nordakademie
As soon as you know which kind of project you want to start there are many different ways to do it. For beginners, you should have a development environment (like the Keil MDK for ARM) for your microcontroller if you want to skip programming in Assembler or C, because you can create the programs by just clicking menus (and the program will be generated automatically).
However, you'll need some sensors or actuators connected to your microcontroller, i.e., some devices that are controlled by it - the "environment". This can be done by soldering or just a patch panel.
Just a few ideas for first projects: Create your own
* model of an elevator
* system that switches on a fan or heater when it detects somebody in the room
* control system for a toy train
* burgler alarm by detecting open windows or doors
* toaster control or coffee maker control (like in Back to the Future)
* TV remote with an infrared LED
* ...
5 Recommendations
Dear Mohammad
There are open source microcontroller simulator for aduino.  You can use with the reading materials.  You don't have to buy the hardware and sensors, just PC and internet connection
Aziz
1 Recommendation
Rakesh P. Tapaskar
K L E Technological University, Formerly known as B.V. Bhoomaraddi College of Engineering and Technology (BVBCET)
Hello Mohamad Hossein Hosseinipoya
Being a developer, I would suggest you learn basic programming aspects of C language before taking up microcontroller programming. Programming a microcontroller is nothing but specifying the set of instructions to a microcontroller in the systematic arrangement to accomplish a certain task. I would recommend you to google for "tutorials of C programming" which will build your logics in programming and then take up microcontroller programming, this would make the learning curve much pleasant. 
As far as learning Arduino programming I would agree with Prof. Vladimir A. Kulchitsky as http://www.arduino.cc is one of the best official online learning resources for Arduino boards.
3 Recommendations
Arduino is the best free option for you to learn the basics
buy from any online marketplace like amazon (better buy one beginners kit)
download the IDE from arduino.cc
install the IDE
run the software
connect the arduino to PC
select the proper COM Port (in windows)
run the sample codes available in IDE
then go for slightly bigger projects , using extra electronics components
sample programs and discussion forums are available here http://www.techberth.com/tb/groups/automation-engineer/
3 Recommendations
Susan Parker
Imperial College London
Arduino... particularly now that the two Arduino factions are getting back together. That was rather confusing (and off-putting).
Also the range of processor hardware that the Arduino ecosystem runs on is greatly expanded with a wide range of processor families from simpler but fast direct hardware control to higher level code with IoT capability.
The great thing with Arduino is that one gets to program directly on the hardware, and can learn with something that is a physical implementation. Turing a LED on or off may seem very simple, but "back in the day" getting to the hardware equivalent of saying "Hello World" could be a huge and daunting task. Now it is a snap!
1 Recommendation
Matheus Oliveira
Trinity College Dublin
You can start by learning basic C programming.
Later, you have to get a development kit. For each microcontroller you want to use, you have to get the datasheet to check memory addresses and pins initialization.
I would recommend to get a Arduino to start learn about C and electronics.
Idris Bouchama
University of Msila
Dear mohamad hossein,
For beginners, Arduino is a brand of microcontroller commonly used amongst hobbyists and professionals alike. Its software is open source, meaning anyone can contribute to the growing pool of recourses available to its users. A simple Google search will yield countless threads, blogs, and forums with examples, documents, and tutorials on how to write code for a desired application. The development suite used to program the Arduino is available for free on their website, Arduino.cc
as an exemples take this links :
good luck.
2 Recommendations
Idris Bouchama
University of Msila
Mohamed Amin Ibrahim
Shanghai University
Hello am student of engineering i have project on trash can contol which microcontroller programing software is the best i can use.
Susan Parker
Imperial College London
As Idris Bouchama says, start with an Arduino.
Which one depends on your application complexity, and if you want wireless connectivity.
1 Recommendation

Similar questions and discussions

Related Publications

Presentation
Full-text available
The study is an automated watering system using Arduino which makes use of technology to deliver consistent labor and services with little human intervention. The study aims to create an automated watering system, with a cost-effective, efficient, and user-friendly human intervention solution. Based on the data collected by the sensors and the data...
Got a technical question?
Get high-quality answers from experts.