Embedded Systems

What is the difference between an Arduino and a Raspberry...

Both are popular for projects, but they are different kinds of devices. An Arduino is a board built around a microcontroller. A Raspberry Pi is a single-board computer that runs an operating system such as Linux.

Main differences: 1) Arduino runs one program directly on the microcontroller, which is good for reading sensors and controlling motors with simple timing and low power use. 2) Raspberry Pi can run many programs, connect to screens, networks and storage, and handle tasks such as image processing or a web server. 3) The two can work together, for example with a Raspberry Pi handling the network and an Arduino handling the hardware.

Choose based on the project, not on which board is more popular. If you need a simple, reliable control task, a microcontroller is often enough.

What project would you build first, and which board would you pick?

What is an interrupt in a microcontroller?

An interrupt is a signal that makes the processor pause its current work, run a short piece of code called an interrupt service routine (ISR), and then go back to what it was doing. It lets a program react quickly to events without checking for them all the time.

How it works: 1) An event occurs, such as a button press, a timer reaching its value or data arriving. 2) The processor saves its place and jumps to the ISR for that event. 3) The ISR does its short task, such as setting a flag. 4) The processor returns to the main program. The alternative, called polling, checks the input again and again.

Keep ISRs short and fast. Do long work in the main loop, and be careful with variables shared between the ISR and the main program.

What event would you handle with an interrupt in a project of yours?

How do I read a button with a GPIO pin, and what are pull...

A GPIO pin is a general-purpose pin on a microcontroller that your program can read or set as high or low. To read a button, you connect it so the pin sees a clear high or low level when pressed or released.

The main ideas: 1) A pin with nothing connected “floats” and can read random values, so you add a pull-up resistor (to the supply voltage) or a pull-down resistor (to ground). Many microcontrollers have internal ones you can switch on in software. 2) With a pull-up, the pin reads high when the button is open and low when pressed. 3) Real buttons bounce: the contact opens and closes quickly for a few milliseconds. Debouncing, in hardware or software, ignores these quick changes so one press counts once.

A common software approach is to accept a change only after the pin has stayed stable for a short time, such as 10 to 50 milliseconds.

Have you wired a button to a microcontroller before?

What is the difference between a microcontroller and a mi...

A microprocessor is a processing chip, the central unit of a computer, and it needs external parts such as memory and input and output chips. A microcontroller combines a processor, memory and input and output peripherals on a single chip.

Key differences: 1) Integration: a microcontroller is a complete small system on one chip. A microprocessor system needs separate components. 2) Use: microcontrollers are common in appliances, toys and sensors. Microprocessors are used where more power and flexibility are needed, as in computers and phones. 3) Cost and power: microcontrollers are often cheaper and use less power.

The line is not always sharp, because modern chips mix features. The terms are best seen as a description of how complete the chip is.

Which would you use for a simple temperature sensor?

What is an embedded system?

An embedded system is a computer built into a larger device to do a specific job. It usually has a processor, memory and input and output connections, and it runs a program that is stored inside the device.

Examples and features: 1) A washing machine controller reads sensors and controls the motor and water valves. 2) A car has many embedded systems, for example for the engine and for the brakes. 3) A digital thermometer, a TV remote and a smart watch also contain them. 4) They often must be small, use little power and respond within a set time.

Unlike a general-purpose computer, an embedded system is not used to run any program the user chooses. Its software is designed for one task or one set of tasks.

Which embedded system do you use every day?

Category