Microcontrollers and custom boards [closed]

I am new to electrical engineering and the usage of microcontrollers. I am trying to build a custom circuit board using parts bought separately, but I'm not sure how this should be done.

Some things aren't clear to me. For example, I want my chip to control a LED that turns on and off at a specified interval. My questions are:

1. How this things should be linked? I mean the microchip has some input and output pins. The output pins should be linked to the part that controls the flow of electricity trough the LED. But what output pin, cause there are more than one.

2. If I have a USB connection connected to an input pin(or more, I'm not sure). How should I load the program in the microchip's memory? Is a boot loader needed? Do I need a special program to write the code in. I assume that I can load the code and if I want to use another code I just load the new one and overwrite the memory.

3. If I want to turn on 3 LEDs at different moments, how should the wires be linked? I guess that I can specify in the code what pin to output to but what if I want to control a lot of LEDs ?

I don't know if my questions are wrong. I'm in high school and I try to learn on myself but google can't find me everything I need.

closed as too broad by The Photon, Scott Seidman, tcrosley, uint128_t, placeholderApr 23 '16 at 18:46

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Your questions are very basic and very broad. Each one should be asked as a separate question. – The Photon Apr 23 '16 at 17:01
• Regarding USB, you can't simply connect a USB cable to some random pin since USB has specific signal voltages and waveforms. Some microcontrollers have USB-specific pins, while others (such as many Arduinos) have a separate chip onboard that acts as a bridge between USB and the microcontroller chip that you program. – Andrey Akhmetov Apr 23 '16 at 17:08
• "google can't find me everything I need" - google is an extremely powerful tool. But for the questions you asked, you need books, not google. – GAttuso Apr 23 '16 at 17:49
• You need to understand basic electrical theory. Voltage, current, power, ohm's law and so on. Without that you won't understand anything, but once you have learned it your questions will have clear answers to you. – Ian Bland Apr 23 '16 at 17:49
• Steve's point about starting with a working board is a good one. What is best is starting with a board for which you can get the schematic, and where it isn't too complicated. You can do initial work there, and build up some knowledge and working code, which you can then use on your first custom board. For all their limitations, older processor in DIP packages have the advantage that your first custom circuit can be built on a breadboard, letting you experiment more readily than a PCB where you may be stuck with certain mistakes until you make another. – Chris Stratton Apr 23 '16 at 18:42

Question 1 and 3

Microcontrollers are CPUs that have special pins dedicated to electronic communication. The most basic unit is GPIO (General-purpose input/output). It allows you to program a pin as an input or an output.

As an output, you can set it to LOW or HIGH (0 or 1). A high output corresponds to a voltage of VCC, which is usually 5V or 3.3V. A low output corresponds to ground or 0V. You can think of each pin as a small battery that can be turned on or off.

As an input, you can read the voltage level. If the voltage is near VCC then the readout will be HIGH (1) and if it is near ground it will be LOW (0).

Though this sound fairly limiting, there are lots of circuits, ICs and breakout boards that communicate using this setup. In fact, this is the basis of Digital Electronics, which is a huge and exciting subject on its own.

I'm including here two basic circuits that should get you going. The first is how to connect an LED to an output GPIO pin, and the second is a pull-down push-button connected to an input GPIO pin.

simulate this circuit – Schematic created using CircuitLab

You also asked about what happens if you need to drive lots of LEDs. Recall that the GPIO pins can be thought of as tiny batteries. If you have many LEDs it can become too much for the pins (to much current required). If so, you might need to use transistors as switching "helpers".

Hopefully, this should give you something to get started.

Question 2

The USB protocol is unfortunately a little complicated. Some micro-controllers don't even support it at all. These are advanced subjects that is probably better answered in a book or some more in-depth material.

In General

To get started, I would recommend going through the Arduino books and examples. These are great in terms of teaching and you can quickly get to a point where you can make interesting projects.

1st of all read the data sheet and user guide of chip that you are going to use. and do some research on internet to find a schematic design for chip or most probably you should be able to find the circuit diagram on data sheet. if you gonna make your own circuit board for micro controller, you have to do a PCB design. to load the program to the chip you have to buy a programmer or you can build a programmer too. But its better to buy a programmer, since you are new to micro-controller programming.