Posted on — Leave a comment

Express a number in IEEE-754 single-precision floating-point format

Sign

0 = positive number
1 = negative number

Biased Exponent(E)

A bias of 127 is to be added to the exponent number.
The biased exponent can range from -126 to +128
Which can fit in 8-bit’s.

Mantissa(F)

There is a one-bit towards the left of the floating point.
It must be noted here that is the number is shorter than 23 bits in length. Zeroes are padded towards the right side. to fit in the 23-bit field.

Posted on — Leave a comment

IEEE-754 32-bit Single Precision Floating Point Representation

IEEE 754 format for the representation of 32 bit single-precision floating-point numbers
IEEE 754 format for the representation of 32 bit single-precision floating-point numbers

In an ARM Cortex, M4F processor-based microcontroller such as STM32L476vg; the floating-point number is stored in accordance to the IEEE-754.

In the above video, I have written a small code using IAR workbench. When I debugged the program using IAR. I have observed that the floating-point number is converted by the compiler into IEEE 754 format and it is being stored in S# registers of the STM32L476vg. Which are the register present in the FPU(Floating Point Unit) or VFP(Vectored Floating Point) unit.

If you want to go into details, here is the abstract

Abstract: This standard specifies interchange and arithmetic formats and methods for binary and decimal floating-point arithmetic in computer programming environments. This standard specifies exception conditions and their default handling. An implementation of a floating-point system conforming to this standard may be realized entirely in software, entirely in hardware, or in any combination of software and hardware. For operations specified in the normative part of this standard, numerical results and exceptions are uniquely determined by the values of the input data, sequence of operations, and destination formats, all under user control.

“IEEE Standard for Floating-Point Arithmetic,” in IEEE Std 754-2008 , vol., no., pp.1-70, 29 Aug. 2008, doi: 10.1109/IEEESTD.2008.4610935.

A great tool to have is the online IEEE 754 convertor

https://www.h-schmidt.net/FloatConverter/IEEE754.html

Posted on — Leave a comment

Arduino Uno I2C LCD Display Using Arduino IDE | In-Browser Code Uploader

The I2C LCD display is a simple way to show text, sensor readings, and status messages in Arduino projects while using only two communication pins. In this project, we will interface a 16×2 I2C LCD with an Arduino Uno and display text on the screen.

Using the In-Browser Flash feature, you can upload the program directly from your browser without copying the code manually.


Components Required

  • Arduino Uno
  • 16×2 I2C LCD Display
  • USB Cable
  • Jumper Wires

About the I2C LCD Display

A standard 16×2 LCD normally requires many Arduino pins. The I2C module attached to the LCD reduces the connection requirement to only four pins:

  • VCC
  • GND
  • SDA
  • SCL

This makes wiring simpler and leaves more pins available for other sensors and modules.


Circuit Connections

I2C LCD PinArduino Uno Pin
VCC5V
GNDGND
SDAA4
SCLA5

Circuit Diagram

Open circuit Open circuit

Arduino Code

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup()
{
lcd.init();
lcd.backlight();

lcd.setCursor(0, 0);
lcd.print("Hello EXASUB");

lcd.setCursor(0, 1);
lcd.print("Arduino Uno");
}

void loop()
{
}

In-Browser Flash

Upload the program directly to your Arduino Uno using the button below.

How to use the In-Browser Flash button


How the Code Works

Include Required Libraries

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

The Wire library enables I2C communication, while the LiquidCrystal_I2C library controls the LCD display.

Create LCD Object

LiquidCrystal_I2C lcd(0x27, 16, 2);

This creates an LCD object with:

  • I2C Address: 0x27
  • 16 columns
  • 2 rows

Initialize LCD

lcd.init();
lcd.backlight();

The LCD is initialized and the backlight is turned on.

Set Cursor Position

lcd.setCursor(0, 0);

Moves the cursor to the first column of the first row.

lcd.setCursor(0, 1);

Moves the cursor to the first column of the second row.

Display Text

lcd.print("Hello EXASUB");
lcd.print("Arduino Uno");

These commands display text on the LCD screen.


Expected Output

After uploading the code, the LCD should display:

Hello EXASUB
Arduino Uno

Troubleshooting

LCD Shows Nothing

  • Check VCC and GND connections.
  • Ensure SDA is connected to A4.
  • Ensure SCL is connected to A5.
  • Adjust the contrast potentiometer on the I2C module.

LCD Displays Random Characters

The I2C address may be incorrect.

Most modules use:

0x27

Some modules use:

0x3F

Finding the I2C Address

If the LCD does not respond, use the following I2C Scanner sketch.

#include <Wire.h>

void setup()
{
Wire.begin();
Serial.begin(9600);

Serial.println("Scanning...");
}

void loop()
{
byte error, address;

for(address = 1; address < 127; address++)
{
Wire.beginTransmission(address);
error = Wire.endTransmission();

if(error == 0)
{
Serial.print("I2C device found at 0x");
Serial.println(address, HEX);
}
}

delay(5000);
}

Open the Serial Monitor to view the detected I2C address.


Applications

  • Digital clocks
  • Temperature displays
  • Home automation systems
  • Menu-driven projects
  • Sensor monitoring systems
  • Robotics projects

Conclusion

In this project, we learned how to interface a 16×2 I2C LCD display with an Arduino Uno and display text on the screen using only two communication pins. I2C LCDs are widely used in Arduino projects because they simplify wiring and provide an easy way to display information.

Use the In-Browser Flash button above to quickly upload the project and start experimenting with LCD displays.

Posted on — Leave a comment

3D Printed Right-Angle Friction Drive Using Cam and Follower

In this project we explore a simple but powerful mechanical idea:
how a rotating cam and a disc-type follower can be used to create a right-angle friction drive — without gears, belts, or electronics.

This entire mechanism is 3D printed and demonstrates how motion can be transferred purely through geometry and contact.


📹 Project Video

FreeCAD Rendering: 3D Printed Right-Angle Friction Drive

https://youtube.com/shorts/w_zL9D7RV9Q


🔧 What is a Right-Angle Friction Drive?

A right-angle friction drive transfers rotation between two shafts that are oriented at 90 degrees to each other using surface contact instead of teeth.

Instead of gears:

  • One rotating surface presses against another
  • Friction forces transfer motion
  • The driven part rotates because of rolling contact

This principle is used in:

  • Record players
  • Paper feeders
  • Conveyors
  • Machine tools
  • Old mechanical clocks

⚙️ How This Mechanism Works

This design uses:

  • A cam disc (rotating plate)
  • A flat roller follower (disc on a shaft)
  • A guided vertical shaft
  • A printed frame that holds everything in alignment

When the cam rotates:

  • It rubs against the flat follower disc
  • The disc rolls along the cam surface
  • That rolling causes the follower shaft to rotate
  • The top plate rotates smoothly as a result

Even though the axes are at right angles, rotation is transferred cleanly.

This is not gear action — it is rolling friction drive.


🧠 Why the Disc Rotates

The follower disc is mounted on a pin and is free to spin.

When the cam touches it:

  • The cam’s surface has tangential velocity
  • That velocity forces the disc to roll
  • Rolling motion turns into shaft rotation

This eliminates sliding friction and allows smooth motion.

In engineering, this disc is called a:

Roller follower


🛠 Why Use Friction Instead of Gears?

Friction drives have unique advantages:

FeatureBenefit
SmoothNo noise, no vibration
SafeSlips instead of breaking
SimpleNo teeth or alignment needed
Shock-proofOverload protection built-in

This is why friction drives are used in printers, CNC feeders, and audio equipment.


🧩 Mechanical Insight

By changing only the cam shape, this same rig can be converted into:

  • A rotary drive (as shown here)
  • A lifting cam
  • A pump
  • A stamping mechanism
  • A timing controller

The cam profile is mechanical programming.

Rotation in → Motion out.


🧪 Why 3D Printing is Perfect for This

3D printing allows:

  • Fast experimentation
  • Custom cam profiles
  • Swappable parts
  • Learning through real motion

This project shows that even with plastic parts, you can explore real kinematic systems used in industry.


📦 Applications of This Concept

This exact principle is used in:

  • Turntable drives
  • Conveyor rollers
  • Filament feeders in 3D printers
  • Mechanical automation systems
  • Educational models

🧠 Final Thought

This project shows that:

Motion does not need electronics — geometry is enough.

A rotating shape can drive, lift, pause, and spin simply by touching another shape.

That is the beauty of mechanical engineering.

Posted on — Leave a comment

Smart City Mini Project Using Arduino UNO

(Street Light Automation, Smart Gate & Air Quality Alert)

Smart cities are built by combining automation, sensing, and decision-making.
In this project, a Smart City model was developed using an Arduino UNO and commonly available sensors to demonstrate how embedded systems can be used for urban automation.

This project focuses on real-world logic, not just blinking LEDs.


📌 Project Demonstration Video

🎥 Watch the complete working demonstration here:

👉 The video shows the automatic street lights, smart gate operation, and air quality alert system working in real time.


Project Overview

The model demonstrates four smart city subsystems working together:

  1. Automatic Street Light System (LDR based)
  2. Smart Entry Gate / Traffic Control (Ultrasonic + Servo)
  3. Air Quality Monitoring System (MQ135 sensor)
  4. Alert System (Buzzer for pollution warning)

Each subsystem works independently but is controlled by a single Arduino UNO, simulating how real smart-city nodes operate.


Components Used

  • Arduino UNO
  • LDR (Light Dependent Resistor – discrete, not module)
  • Ultrasonic Sensor (HC-SR04)
  • Servo Motor (gate control)
  • MQ135 Air Quality Sensor
  • Buzzer
  • LEDs (street lights)
  • 330 Ω resistors (current limiting)
  • Breadboard, jumper wires, external LED wiring

🔌 Circuit Diagram

🧩 Complete circuit diagram for this project:

Open circuit Open circuit

The circuit includes:

  • LDR voltage divider connected to an analog input
  • Ultrasonic sensor connected to digital pins
  • Servo motor connected to a PWM pin
  • MQ135 sensor connected to an analog input
  • Buzzer connected to a digital output
  • LED street lights driven through resistors

Street Light Implementation (Important Design Detail)

To simulate street lights, multiple LEDs were used.

Instead of driving LEDs directly from the Arduino pin, the following safe current-limiting method was implemented:

  • Two GPIO pins were used for street lighting
  • Each GPIO pin was connected through a 330 Ω resistor
  • The other end of each resistor was connected to 4–5 LEDs in parallel

Why this method was used

  • The resistor limits the current drawn from the GPIO pin
  • Using two GPIOs distributes the load instead of stressing a single pin
  • Parallel LEDs represent multiple street lights connected to one junction

This approach keeps the circuit safe for the Arduino while still allowing multiple LEDs to turn ON together during night conditions.


Automatic Street Light Logic (LDR)

  • The LDR continuously measures ambient light
  • During daytime:
    • LDR value is high
    • Street LEDs remain OFF
  • During night:
    • LDR value drops below a threshold
    • Street LEDs turn ON automatically

This demonstrates energy conservation, a core principle of smart cities.


Smart Gate / Traffic Control System

An ultrasonic sensor is placed near the entry point of the model.

  • When a vehicle or object comes within a fixed distance:
    • The ultrasonic sensor detects it
    • The servo motor rotates
    • The gate opens automatically
  • When the object moves away:
    • The gate closes again

This simulates automatic toll gates, parking entry systems, and traffic barriers.


Air Quality Monitoring (MQ135 Sensor)

To introduce environmental monitoring, an MQ135 air quality sensor was added.

  • The sensor measures pollution levels in the surrounding air
  • When the pollution value crosses a preset threshold:
    • The buzzer turns ON
    • This acts as an air pollution warning

This models how pollution monitoring stations work in smart cities.


Alert System (Buzzer)

The buzzer is used as a city alert mechanism.

  • OFF during normal air conditions
  • ON when pollution exceeds safe limits

This introduces the concept of public warning systems and real-time environmental alerts.


💻 Firmware Upload (Arduino Code)

⚡ Flash the firmware directly to Arduino UNO:

👉 This allows users to upload the tested firmware without opening the Arduino IDE.

#include <Servo.h>

#define TRIG_PIN 9
#define ECHO_PIN 8
#define LED_PIN  3
#define LED_PIN1 5
#define LDR_PIN  A0
#define MQ135_PIN A1
#define BUZZER_PIN 7
#define SERVO_PIN 6

Servo gateServo;

long duration;
int distance;
int ldrValue;
int airValue;

int LDR_THRESHOLD = 500;     // adjust after testing
int DIST_THRESHOLD = 15;     // cm
int AIR_THRESHOLD  = 400;    // MQ135 threshold (adjust)

void setup() {
  pinMode(TRIG_PIN, OUTPUT);
  pinMode(ECHO_PIN, INPUT);
  pinMode(LED_PIN, OUTPUT);
  pinMode(LED_PIN1, OUTPUT);
  pinMode(BUZZER_PIN, OUTPUT);

  gateServo.attach(SERVO_PIN);
  gateServo.write(90);   // gate closed

  Serial.begin(9600);
  Serial.println("Smart City System Starting...");
}

void loop() {

  /* ---------- LDR STREET LIGHT ---------- */
  ldrValue = analogRead(LDR_PIN);

  if (ldrValue < LDR_THRESHOLD) {
    analogWrite(LED_PIN, 255);     // street light ON
    digitalWrite(LED_PIN1, HIGH);
  } else {
    digitalWrite(LED_PIN, LOW);    // street light OFF
    digitalWrite(LED_PIN1, LOW);
  }

  /* ---------- ULTRASONIC SENSOR ---------- */
  digitalWrite(TRIG_PIN, LOW);
  delayMicroseconds(2);
  digitalWrite(TRIG_PIN, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG_PIN, LOW);

  duration = pulseIn(ECHO_PIN, HIGH, 30000);
  distance = duration * 0.034 / 2;

  /* ---------- SERVO GATE CONTROL ---------- */
  if (distance > 0 && distance < DIST_THRESHOLD) {
    gateServo.write(0);    // open gate
  } else {
    gateServo.write(90);   // close gate
  }

  /* ---------- MQ135 AIR QUALITY ---------- */
  airValue = analogRead(MQ135_PIN);

  if (airValue > AIR_THRESHOLD) {
    digitalWrite(BUZZER_PIN, HIGH);   // pollution alert
  } else {
    digitalWrite(BUZZER_PIN, LOW);
  }

  /* ---------- SERIAL MONITOR ---------- */
  Serial.print("LDR: ");
  Serial.print(ldrValue);
  Serial.print(" | Distance: ");
  Serial.print(distance);
  Serial.print(" cm | Air: ");
  Serial.println(airValue);

  delay(1000);
}

Software Logic Summary

The Arduino program continuously performs:

  • Ambient light measurement (LDR)
  • Distance measurement (Ultrasonic)
  • Air quality measurement (MQ135)
  • Decision-making based on thresholds
  • Actuator control (LEDs, servo, buzzer)

All logic runs in a loop, similar to how embedded systems operate in real infrastructure.


Educational Value

This project helps learners understand:

  • GPIO usage and current limiting
  • Sensor interfacing and calibration
  • Real-world automation logic
  • Embedded decision-making
  • Power and safety considerations
  • Smart city concepts beyond theory

Unlike ready-made kits, this setup uses discrete components, encouraging deeper understanding and troubleshooting skills.


Conclusion

This Smart City project demonstrates how simple electronics and embedded programming can be combined to address urban automation challenges such as energy efficiency, traffic control, and pollution monitoring.

It serves as a reference implementation for students and educators exploring smart-city concepts using Arduino.

Posted on — Leave a comment

Arduino Uno Dot Matrix Display Using MAX7219 (Scrolling Text)

In this project, we interface an 8×8 Dot Matrix Display (MAX7219) with Arduino Uno to display scrolling text using the MD_Parola library.

This setup is ideal for learning:

  • SPI communication
  • External display control
  • Library-based programming
  • Real-time visual output from code

All components, wiring, code, and flashing are available on a single page for smooth lab execution.


Circuit Diagram (Arduino Uno + MAX7219)

The circuit below shows the exact wiring required between the Arduino Uno and the dot matrix module.

👉 Open this on the board or laptop and follow the connections directly.

Open circuit Open circuit

Pin Connections

MAX7219 ModuleArduino Uno
VCC5V
GNDGND
DIND11
CS / LOADD10
CLKD13

Output Preview

The following video shows the expected output after successful wiring and code upload.

📺 Demo Video
https://youtube.com/shorts/sZoBYKpf11I


Required Libraries

This project uses the following Arduino libraries:

  • MD_MAX72XX
  • MD_Parola

How to Install Libraries

  1. Open Arduino IDE
  2. Go to Sketch → Include Library → Manage Libraries
  3. Search and install:
    • MD_MAX72XX
    • MD_Parola
  4. Restart Arduino IDE after installation

If libraries are missing, the code will not compile.


Arduino Uno Code (Scrolling Text)

Copy and paste the following code into Arduino IDE:

#include <MD_Parola.h>
#include <MD_MAX72XX.h>
#include <SPI.h>

#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 1   // Number of dot matrix modules
#define CS_PIN 10       // CS (LOAD) pin

MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);

void setup() {
  P.begin();
  P.displayText("HELLO!", PA_CENTER, 70, 0, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
}

void loop() {
  if (P.displayAnimate()) {
    P.displayReset();
  }
}

Uploading Code to Arduino Uno

  1. Connect Arduino Uno using USB cable
  2. Select:
    • Board: Arduino Uno
    • Port: Correct COM port
  3. Click Upload

One-Click Arduino Flash (Recommended)

To avoid IDE and driver issues, use the flash button below to upload firmware directly.


Common Issues and Fixes

  • No display output
    • Check VCC and GND
    • Verify CS pin is set to 10 in code
  • Compilation error
    • Confirm both libraries are installed
  • Display orientation incorrect
    • Ensure FC16_HW hardware type is selected

Next Steps

You can extend this project by:

  • Adding a joystick to control text movement
  • Changing text dynamically
  • Using multiple dot matrix modules
  • Creating interactive animations

This project forms a strong foundation for input + output based embedded systems.