Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Nano 33 BLE Magnetic Levitation System with Hall Sensor Feedback and Status LED Indicator

View and Edit Project In Cirkit DesignerImage of Arduino Nano 33 BLE Magnetic Levitation System with Hall Sensor Feedback and Status LED Indicator

Circuit Documentation

Summary of the Circuit

This circuit is designed to control a magnetic levitation system using a Hall sensor, a TIP120 transistor, and an Arduino Nano 33 BLE. The Hall sensor detects the magnetic field strength, and the Arduino adjusts the current through a coil to levitate a magnetic object. Additionally, an LED is used to indicate the system status, lighting up when the coil is active.

Component List

Nano 33 BLE with pinout

DC Source 5V

Hall Sensor

Diode

TIP120 Hi-Current Darlington Transistor

Resistor (1k Ohms)

Resistor (220 Ohms)

Copper Coil

LED: Two Pin (red)

Comments

Wiring Details

Nano 33 BLE with pinout

DC Source 5V

Hall Sensor

Diode

TIP120 Hi-Current Darlington Transistor

Resistor (1k Ohms)

Resistor (220 Ohms)

Copper Coil

LED: Two Pin (red)

Documented Code

/*
 * Arduino Sketch for Magnetic Levitation
 *
 * This code controls a magnetic levitation system using a Hall sensor and a
 * TIP120 transistor. The Hall sensor reads the magnetic field strength, and
 * the Arduino adjusts the current through a coil to levitate a magnetic object.
 * An LED is used to indicate the system status.
 */

const int hallSensorPin = A1; // Hall sensor output connected to A1
const int coilControlPin = 5;  // TIP120 base connected to D5
const int ledPin = 9;          // LED anode connected to D9

void setup() {
  pinMode(coilControlPin, OUTPUT); // Set coil control pin as output
  pinMode(ledPin, OUTPUT);         // Set LED pin as output
  pinMode(hallSensorPin, INPUT);   // Set Hall sensor pin as input
}

void loop() {
  int hallValue = analogRead(hallSensorPin); // Read Hall sensor value
  int coilValue = map(hallValue, 0, 1023, 0, 255); // Map sensor value to PWM
  analogWrite(coilControlPin, coilValue); // Control coil current
  if (coilValue > 128) {
    digitalWrite(ledPin, HIGH); // Turn on LED if coil is active
  } else {
    digitalWrite(ledPin, LOW);  // Turn off LED if coil is inactive
  }
  delay(10); // Small delay for stability
}

The code is written for the Arduino Nano 33 BLE and is responsible for reading the Hall sensor data, controlling the current through the coil, and managing the LED indicator.