Cosmic Scales - Arduino Based Interplanetary Weight Machine
by _Stemonkey in Circuits > Arduino
75 Views, 1 Favorites, 0 Comments
Cosmic Scales - Arduino Based Interplanetary Weight Machine
Arduino-Based Planetary Weight Calculator
Introduction
Inspired by the Stars
Recently, I visited the Jawaharlal Nehru Planetarium and was fascinated by one of their exhibits. The exhibit had a weight machine that displayed your weight on different planets in our Solar System. This experience sparked an idea: why not create a similar device at home using an Arduino? So, I embarked on a journey to build a Planetary Weight Calculator using an Arduino Uno, a 4x4 matrix keypad, and an I2C LCD display.
This project allows you to input your weight on Earth and instantly see what you would weigh on other planets—and even on dwarf planets like Ceres and Makemake! It's a fun and educational tool that can be used in classrooms, science fairs, or just for some space-themed fun at home.
Step 1: Gather Your Materials
Hardware Components
- Arduino Uno: The main microcontroller that runs the program.
- 4x4 Matrix Keypad: For entering your weight and controlling the device.
- I2C 16x2 LCD Display: To display your weight on Earth and other planets.
- Buzzer: (Optional) Provides audio feedback for keypresses and errors.
- Connecting Wires: For assembling the circuit on a breadboard.
- Breadboard: To connect all the components together.
Step 2: Circuit Assembly
Connecting the Keypad
- Connect the rows and columns of the 4x4 keypad to the Arduino's digital pins.
- Make sure to define the correct pin connections in the code.
Connecting the I2C LCD
- Connect the I2C LCD to the Arduino’s SDA(A5) and SCL(A4) pins of arduino, VCC to 5V and GND to GND respectively.
- Ensure the I2C address matches the one in your code (usually 0x27).
Optional: Connecting the Buzzer
- Connect the positive lead of the buzzer to a digital pin on the Arduino. (D11) of Arduino.
- Connect the negative lead to the ground.
(Refer the image for wire connection)
Writing the Code:
Setting Software Libraries
- Wire.h: For I2C communication between Arduino and the LCD.
- LiquidCrystal_I2C.h: To control the I2C LCD.
- Keypad.h: For interfacing with the 4x4 keypad.
Handle Key Presses
Set up key functionalities to handle weight input, unit toggling, confirmation, and clearing:
- # (Confirm): Confirms the weight input and calculates weights on other planets.
- * (Clear/Reset):
- Short Press: Clears the current input field.
- Long Press (More than 2 seconds): Resets the entire input process.
- A (Info) Display the info on the display about how to use the device.
- C (Toggle Units): Switches between kilograms (Kg) and pounds (lbs).
- D (Decimal Point): Adds a decimal point to the weight input.
- A (Help): Displays the functionality of each key.
Display Weight on Planets
Store the gravitational ratios and planet names in arrays to calculate and display the user's weight on each planet:
const String planets[] = {"Moon", "Mercury", "Venus", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto", "Ceres", "Eris", "Haumea", "Makemake"}; const float gravities[] = {0.165, 0.378, 0.907, 0.377, 2.36, 0.916, 0.889, 1.12, 0.063, 0.028, 0.082, 0.044, 0.05};
Conclusion
By following these steps, you can built your own Planetary Weight Calculator! This device is not only a fun and interactive tool but also an educational one. It can help demonstrate the effects of gravity on weight, teaching users how their weight would change on different celestial bodies.
This project is perfect for science fairs, classroom demonstrations, or just as a cool gadget to have around the house. Whether you’re fascinated by space or just enjoy building things with Arduino, this project is sure to inspire and educate.
Enjoy your Arduino-based Planetary Weight Calculator, and keep exploring the wonders of the universe!