Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [microcontroller]

A device which includes a central processing unit (CPU), memory, and (generally) an assortment of I/O peripherals (UART, ADC, DAC, general-purpose I/O, I2C, etc.) in a tightly-coupled standalone package.

42
votes
8answers
6k views

How to choose a MCU platform? [closed]

There are numerous MCU platforms and once somebody has gotten used to one, they are generally reluctant to switch to another platform. My question is: If one started using a MCU for general purpose ...
184
votes
13answers
241k views

What's the difference between a microcontroller and a microprocessor?

What's the difference between a microcontroller and a microprocessor?
165
votes
16answers
79k views

Is C++ suitable for embedded systems?

A common question, here and elsewhere. Is C++ suitable for embedded systems? Microcontrollers? RTOSes? Toasters? Embedded PCs? Is OOP useful on microcontrollers? Does C++ remove the programmer too ...
13
votes
3answers
8k views

Driving DC motors with MOSFETs and a microcontroller?

I'm developing a nano quadcopter using an Atmega328 microcontroller, powered at 3.3V, and very small brushed DC motors. The average current used by these motors is about 800mA @ 3.7V. Initially, to ...
29
votes
2answers
13k views

How can I detect a power outage with a microcontroller?

I have the following power supply configuration: AC MAINS -> UPS -> 24V POWER SUPPLY -> 5V VOLTAGE REGULATOR -> PCB (microcontroller). What's the best solution to detect the power outage on the mains ...
12
votes
5answers
5k views

“Overclocking” an AVR

In AVR datasheets under the Electrical Characteristics section you will typically find a graph like this (this one is from the ATMega328): I've seen designs that seem to "work" but operate outside ...
15
votes
6answers
27k views

How to read high voltages on microcontroller?

I want to read high voltages, like ~50V, using a microcontroller. I plan to put this as an input into the microcontroller's A/D line. But of course, you shouldn't have voltage that high on the input ...
6
votes
3answers
3k views

Crystal oscillator load capacitance, again

There's a lot of seemingly conflicting information regarding how the load capacitance for a parallel resonant crystal is calculated. Faced with a lot of problems in recent years with non-oscillation ...
0
votes
2answers
2k views

Using AC current to trigger Triac

I am trying to simulate the operation of an optocoupler with a triac to trigger the triac using the AC current. I have come across a few circuits that are all similar: My question is regarding the ...
22
votes
3answers
67k views

How to drive a MOSFET with an optocoupler?

What's the proper schematic for driving this MOSFET from a microcontroller pin through this or this optocoupler? The MOSFET will drive a motor @ 24V, 6A.
27
votes
6answers
12k views

Is it really a bad idea to leave an MCU input pin floating?

I've heard that leaving a pin floating on an MCU when configured as an input (vs. the default output) is bad for the pin, and can eventually cause it to fail prematurely. Is this true? N.B. in my ...
10
votes
6answers
7k views

How do I sample a -2 V to +2 V analog signal with a PIC microcontroller?

I am using a PIC micro with a 10bit ADC to take readings from an analog signal with a frequency less than 300 hz. However that analog signal is in the range of -2 V and +2 V. How can I condition the ...
45
votes
3answers
83k views

Push-pull/open drain; pull-up/pull-down

I am reading the datasheet of an ARM Cortex chip, specifically the GPIO chapter. Ultimately, I want to configure various GPIO pins to use them in "Alternate Function" mode for read/write access to ...
54
votes
6answers
53k views

When is a MOSFET more appropriate as a switch than a BJT?

In my experimentation, I've used only BJTs as switches (for turning on and off things like LEDs and such) for my MCU outputs. I've been repeatedly told, however, that N-channel enhancement-mode ...
32
votes
2answers
26k views

Selecting a MOSFET for driving load from logic

I'm looking to drive a magnetic door lock from an Arduino. I've found a question about driving a solenoid from an Arduino, which includes a circuit that looks perfect for this kind of situtation: ...
29
votes
9answers
9k views

What happens when an embedded program finishes?

What happens in an embedded processor when execution reaches that final return statement Does everything just freeze as it is; power consumption etc, with one long ...
28
votes
4answers
11k views

Reason of multiple GND and VCC on an IC

What is the reason that most of ICs (e.g. MCU) has multiple (A/D)GND and (A)VCC pins? If it is to increase performance of an IC, how does it help to performance? or is it easier for the IC designer ...
5
votes
2answers
2k views

Level shift circuit MCU to MOSFET

I have a H-bridge that is being supplied by 12V and using around 10A. I am turning it on/off with a microcontroller that has an output of 0V-5V. The switching frequency is "super low" so the gate ...
50
votes
3answers
87k views

What is a boot loader, and how would I develop one?

I've met many projects in which an AVR microcontroller uses with a bootloader (such as the Arduino), but I don't understand the concept very well. How can I make a bootloader (for any microcontroller)...
29
votes
11answers
17k views

I'd like to learn how to make my own USB gadgets

I've been writing Linux character device drivers for other people's stuff for some time. I'd like to find a new hobby and the thought of making my own USB gizmos seems really neat. I would be ...
20
votes
6answers
31k views

Internal or external oscillator

I always use the internal oscillator that pics have as I have never found the need to run anything at higher frequency than 8 MHz (which is the fastest the pics I use tend to be able to go). Are there ...
17
votes
4answers
2k views

Current sensing nA to mA

I need to sense the current of a target MCU through various periods of its on/sleep/off state and then need to send this data back to another interface MCU to read out the value. They will be both on ...
13
votes
4answers
6k views

Wear leveling on a microcontroller's EEPROM

For example: The datasheet for ATtiny2313 (as do most Atmel AVR datasheets) states: 128 Bytes In-System Programmable EEPROM Endurance: 100,000 Write/Erase Cycles Imagine a program only requires ...
3
votes
3answers
2k views

12 hours delay with ATmega16A

I am trying to turn on a LED for 5sec every 12 hours. I tried: ...
11
votes
3answers
8k views

Control 220V AC line using MCU

I want to switch ON and OFF an incandescent bulb using MCU. Please suggest an electric switch (like relay or something) for 220V 50Hz AC line which can be used here. I would prefer something very ...
18
votes
4answers
4k views

Crystals and load capacitance

If a crystal has a rated load capacitance of 6 pF, is the right thing to do to put a 6 pF capacitor to GND on either leg of the crystal? I'm using it as the clock source (TOSC) for an XMEGA and it's ...
7
votes
1answer
247 views

Can I use blue-green LEDs as MCU state indicators on 3.3 V power?

Modern electronics industry has developed very efficient LEDs with nice and fancy colors (“true green” , “cyan”, and “blue”) based in InGaN technology, or similar. Some of these LEDs are specified as ...
77
votes
11answers
13k views

What's the cheapest way to link a few microcontrollers wirelessly at low speeds over short distances

What's the cheapest way to link a few microcontrollers wirelessly at low speeds over short distances. I'm looking to keep it ultra-cheap, use common discrete parts and keep it physically small. I don'...
35
votes
5answers
80k views

FPGA's vs Microcontrollers [closed]

I've worked on the Arduino family (specifically the Sanguino), built a few simple devices and a simple phototrope. I am thus pretty comfortable with microcontrollers - specifically Atmel's. I'm ...
19
votes
10answers
80k views

What are the cheapest microcontrollers?

What are the cheapest microcontrollers available? This would be in volumes over 1000, though hobbyist availability would be nice. I'm looking for the cheapest of all microcontrollers - my ...
48
votes
7answers
36k views

How do I measure a negative voltage with a ADC?

I am working with a PIC micro-controller with inbuilt 10bit ADC and want to measure a voltage in the range of -1 to -3Volts. I thought of using an op-amp in the inverting mode to make voltage positive ...
46
votes
16answers
54k views

Why use PLC instead of microcontroller?

Why does everyone use PLCs in industrial environments, instead of a microcontroller based solution? For a longer task, the PLC program is as complicated as a microcontroller program. A ...
36
votes
4answers
10k views

How to synchronize two microcontrollers to micro-second accuracy?

I need to synchronize two micro-controllers so that they can measure the speed of propagating waves. The time delay measurements need have microsecond accuracy (error less that 1/2 of a microsecond). ...
8
votes
10answers
3k views

12V input on microcontroller pin

I'm trying to count pulses/sec. on a microcontroller pin in the ~5 to 100Hz range. The µC can operate at 5V input, so I have to get the voltage level down safely. A simple resistor comes to mind, yet ...
4
votes
3answers
41k views

Transmitting a video stream through a microcontroller's wifi

I'm working a a project that currently works well but this year we want to expand it by collecting data from it, independent of its current functions. We have set up an iPad App to control an Arduino ...
17
votes
4answers
15k views

How critical are UART frequencies?

I'm going to be using an 8 MHz crystal to run my microcontroller at 16 MIPS (PLL 4x, 2 cycle instructions.) However, 8 MHz doesn't divide into any UART frequencies AFAIK... so how critical are these ...
9
votes
2answers
19k views

Driving LED strip from microcontroller

I want to drive a strip of LEDs from a microcontroller using PWM to control the brightness. The strip I have takes about 1.5A at 12V. I'm only familiar with purely low power digital electronics so ...
10
votes
4answers
1k views

ICSP or Pre-Programmed Microcontroller

I've designed a PCB for small scale production; currently I'm hand soldering them in batches of 20 at a time. This PCB uses an ATMEGA168 microcontroller which I program before soldering to the board - ...
6
votes
7answers
11k views

Multiplexing Inputs on a microcontroller

I have a 4 way DIL switch that I use to provide input to a microcontroller, and I need to free up a port to use for something else. Is there a way to multiplex 4 inputs into 3 microcontroller ports? ...
8
votes
2answers
5k views

How to deal with multiple pull-up resistors on modules

I was thinking about doing a modules for a development board I did a few days ago that will include spi/i2c interfaces. The problem is that I didn't included pull-up resistors in the MCU pins in the ...
1
vote
3answers
2k views

Driving LED with PIC 5V

I have always been taught to driver an LED using an MCP using the following method (Driving the pin high) as shown in the diagram below: However I have recently seen LED's being driven using the ...
5
votes
2answers
6k views

What is the best way to estimate the power consumption of an Atmega328p microcontroller?

I'm currently working with a barebone Atemga328p microcontroller implemented within a battery powered design. I've realized I'm pretty clueless on how microcontrollers are rated on power consumption. ...
47
votes
20answers
76k views

What is a good microcontroller for Ethernet applications?

What is a good microcontroller for doing Ethernet applications? Or do I just need a good Ethernet library to connect with an Ethernet MAC/PHY?
16
votes
3answers
9k views

How to implement a soft power switch controllable by microcontroller?

I want to design a circuit such that the microcontroller can toggle a GPIO pin and shut the whole system (including microcontroller itself) down. And when the user presses a momentary button, the ...
22
votes
6answers
2k views

How do I plan a long range product with microcontroller that needs long term support?

I need to use a microcontroller on a system that must stay working without major changes for a long time (decades). To ensure that there always will be replacement parts, I need a microcontroller that ...
16
votes
6answers
24k views

How is binary converted to electrical signals?

I'm just starting off in electronics and am already fascinated. Having played with an Arduino these past few days I'm aware that binary is a representation of different voltages - such as +5V ...
15
votes
5answers
33k views

Pull-up and Pull-down Resistor Usage on Input or Output MCU Pins

Are pull-up/down resistors (whether internal or external) only needed for MCU INPUT pins? In contrast, an MCU pin configured as an OUTPUT "knows what level it's at" because it does the driving - a "...
24
votes
2answers
6k views

C coding design - function pointers?

I have a PIC18F46K22 and program it with the XC8 compiler. In the end, I'll have a system like a pc with stdin and stdout. So in ...
10
votes
3answers
18k views

What is the minimal set of parts for a circut with this AVR microcontroller?

My Arduino Uno has a ATMEGA328P-PU microcontroller, and bunch of other stuff on the board. I'd like to program the chip without the Arduino software, and only the minimum of other components. I want ...
6
votes
2answers
8k views

Driving Solenoids from Arduino

I was wondering what the best way to run a solenoid would be from an Arduino board. I was thinking about using a MOSFET that runs into a relay to turn on the solenoid but am not sure how to go about ...