Electronics
EEPROM
EEPROM (Electrically Erasable Programmable Read-Only Memory) is a type of non-volatile memory used in microcontrollers to store small amounts of data that must be preserved when power is removed.
- Non-volatile (data remains in storage.)
- Writable and erasable (Unlike traditional ROM)
Motors
Quadrature Encoders
Quadrature means the design where two waves (square wave, sine wave, etc.) are 90 deg out of phase. In a quadrature encoder, two light sources are placed in slightly different positions, so their waves are 90 deg out of phase. With this design, we can tell the direction of rotation, and the number of ticks a motor has rotated.
The two light sources produce a waveform:
One can see that if slots and hollows on the encoder disk are equal length, we can produce the clean square wave. There are 4 combinations of pulses:
- Rising edge of Channel A.
- Falling edge of Channel A.
- Rising edge of Channel B.
- Falling edge of Channel B.
By looking at edge rising / falling status and the other channel’s value, we can achieve “resolution = 4*360 deg / num_of_lines”. This is how it works:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
def encoder_callback(channel):
"""Interrupt callback to handle encoder state changes."""
global position, last_state_a, last_state_b
# Read current states of both channels
current_state_a = GPIO.input(ENCODER_A_PIN)
current_state_b = GPIO.input(ENCODER_B_PIN)
# Determine direction based on state transitions
if last_state_a == 0 and current_state_a == 1: # Rising edge on A
if current_state_b == 0: # B is low, moving clockwise
position += 1
else: # B is high, moving counterclockwise
position -= 1
elif last_state_a == 1 and current_state_a == 0: # Falling edge on A
if current_state_b == 1: # B is high, moving clockwise
position += 1
else: # B is low, moving counterclockwise
position -= 1
Absolute Encoder
An absolute encoder has a coded encoder disk. It comprises of a few concentric tracks (circles), each track has a hollow (0) and a slot (1). This way, we can read the absolute position of an encoder disk.
Capacitors
- In betwen plates of a capacitor, we need dielectric. It’s an insulating material that increases the capacitor’s ability to store charge. Dielectrics include: air, vacuum, ceramic, electrolytic, etc.
- In an ideal dielectric there is no current flow.
- A capacitor gathers charge via displacement current, not conduction current across the plates:
- You connect a voltage source (like a battery) across the plates.
- Electrons accumulate on one plate (negative terminal of the source).
- This creates an electric field through the dielectric.
- That electric field repels electrons from the opposite plate (pulling positive charge toward it).
- No electrons physically cross the dielectric — they just pile up on each side.
EC (Electrically Commuted Motors) vs DC Motors
TODO
Electronics Testing
ICT (In-Circuit Testing)
ICT is a type of testing performed directly on PCB to check each component for open / short circuits, incorrect part placement. Method:
- Build a “bed-of-nails” fixture that includes test points, probes
- The fixture measures resitance, voltage, capacitance
So it’s quick, good test coverage, automated. but it can’t test the high level features.
Functional Testing
Test the system’s overall performance, such as communication, user interfaces, power distribution.
MEMS IMU
Accelerometer
When linear acceleration occurs, an inertial mass suspended inside the MEMS structure displaces relative to fixed electrodes. This displacement changes the capacitance between the mass and surrounding plates. By measuring these changes, we can infer the applied linear acceleration.
Gyro
Gyroscopes use the Coriolis effect. The Coriolis force arises in a rotating reference frame and causes moving objects to appear to deviate from a straight-line path. For example, a ball rolling straight in an inertial frame appears to curve when observed from a rotating disk.
With stationary frame travelling direction of the object v
and angular velocity w
, the perceived Coriolis Force is
And the Coriolis force is perpendicular to both v
and w
A MEMS gyroscope often uses a ‘tuning fork’ design with two proof masses vibrating in opposite directions. Each mass is suspended by springs and forms capacitors with fixed side plates. When the device rotates, Coriolis forces cause the masses to deflect perpendicular to both their vibration and the rotation axis. This results in a measurable change in capacitance, with a net difference:
which is proportional to angular velocity.
If linear acceleration occurs along the sensing axis, both masses are displaced in the same direction, resulting in opposing changes in capacitance. The net differential change is:
allowing the system to distinguish linear acceleration from angular rotation.