Categories
DevLogs

Displaying .BMP with NeoPixel RGB LED Matrix (WS2812B) on Arduino

Many/all tutorials online that I found are either not working or not completed with the instructions. This tutorial will guide you through the process of displaying .bmp files on an Arduino using an 8×32 LED matrix (but you can also use other). We will be using the LCD Image Converter application for Windows to convert the image files into a C array that can be easily integrated into an Arduino sketch.

Prerequisites

  • Arduino board with an 8×32 LED matrix
  • LCD Image Converter application (Windows) installed from: LCD Image Converter
  • Basic knowledge of Arduino programming and uploading sketches

Steps

1. Installing the LCD Image Converter Application

  • Download and install the LCD Image Converter application from the provided link.
  • For users on other operating systems, set up a virtual machine to run the Windows application.

2. Preparing the Image

  • Launch the LCD Image Converter application.
  • Click on File > Open and select the image file you want to display on your LED matrix.
  • Use the editing tools within the application to rotate the image if needed, ensuring it matches the orientation of your LED matrix.

3. Importing Preset Settings

  • Go to Options > Conversion.
  • Click on Import… and choose the LOUIS.xml file provided in this repository. This preset is specifically designed for an 8×32 LED matrix.
  • Modify the photo resolution in the application according to your LED matrix size if necessary.

4. Generating the C Array

  • Click on Show Preview to see the converted image.
  • Copy the generated C array.

5. Integrating the C Array into Arduino

  • Open your Arduino IDE or preferred code editor.
  • Load the Arduino code LOUIS_GAN_LED_MATRIX.ino
  • Locate the section of the sketch where you want to display the image.
  • Paste the copied C array into the sketch, making sure it is placed within the appropriate code section.
  • If you have multiple images that you want to display in a loop, add another C array and paste it into the desired section of the sketch.

6. Uploading the Sketch

  • Connect your Arduino board to your computer via USB.
  • Select the correct board and port in the Arduino IDE.
  • Click on the Upload button to compile and upload the sketch to the Arduino.

7. Testing

  • After the sketch is successfully uploaded, the LED matrix should display the converted image.
  • If you have multiple images in the sketch, they should play in a loop according to your code implementation.

Additional Resources

Congratulations! You have successfully displayed .bmp files on an Arduino using an 8×32 LED matrix. Feel free to explore further and experiment with different images and LED matrix configurations.

Categories
DevLogs

WHW HackClub 2023 Final Results!

There were complications in getting the Hack Club Bank to work and parts were slow to ship from overseas – but finally I got all the parts to work and here is the first prototype of the Triton Amphibious Rover! https://github.com/hackclub/winter/blob/main/thelouisgan.md

The RC controlled rover features a LEGO Technic vehicle that I coupled with a motor, and for the water side of things I rigged an underwater motor and 3D printed rudder to a 25KG servo motor. All this is remotely controlled with an RC so that you can take it to explore different terrain and locations! It is also powered by a rechargeable LiPo battery and will be able to operate up to 15 minutes on a full charge in optimal conditions. Will update more photos and videos of it in action soon!

Please do give feedback/suggestions as this is my first big scale project and thanks to @mel and @belle for the support.

Categories
DevLogs

WHW HackClub 2023 Programming + Testing

Arduino Programming

Programming the Arduino will be done on an already owned PC with the stock Arduino IDE. The Arduino sketch will need to provide the following tasks:

  • Servo Rudder
  • Take PWM info in via RC RX
  • ESC Motor Driver
  • Variable Thrust
  • Lighting (NeoPixel Effects)
Show Arduino Code
// Libraries for Program B
#include <FastLED.h>

// Program A variables
const int CH5_PIN = 2;  // Channel receiver pin
const int CH6_PIN = 3;  // New channel receiver pin
const int LIGHT_PIN = 4;  // Lightbulb pin

// Program B variables
#define NUM_LEDS 30  // Number of LEDs on the strip
#define DATA_PIN 5  // Data pin of the LED strip
#define LED_PIN 5   // !! DATA_PIN = LED_PIN !! LED STRIP
#define NUM_COLORS 4  // Number of colors in the ocean gradient

CRGB leds[NUM_LEDS];  // Array to store the LED colors

// Define the ocean color palette
CRGBPalette16 oceanPalette = CRGBPalette16(
  CRGB(0, 0, 255),    // dark blue
  CRGB(0, 92, 200),   // medium blue
  CRGB(0, 255, 255),  // cyan
  CRGB(0, 0, 255)     // dark blue
);

void setup() {
  // Initialize serial communication
  Serial.begin(9600);

  // Set pins as input/output
  pinMode(CH5_PIN, INPUT);
  pinMode(LIGHT_PIN, OUTPUT);
  pinMode(CH6_PIN, INPUT);

  // Initialize FastLED library
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setBrightness(100);  // Set brightness to maximum
}

void loop() {
  // Read channel receiver input
  int CH5 = pulseIn(CH5_PIN, HIGH);
  int CH6 = pulseIn(CH6_PIN, HIGH);

  // Check channel input range for lightbulb
  if (CH5 >= 900 && CH5 <= 1100) {
    digitalWrite(LIGHT_PIN, HIGH);  // Turn on lightbulb

    // Check channel input range for LED strip
    if (CH6 >= 900 && CH6 <= 1100) {
      static uint8_t hue = 0;
      uint8_t index = 0;

      // Fill the LED array with colors from the ocean palette
      for (int i = 0; i < NUM_LEDS / 2; i++) {
        index = map(i, 0, NUM_LEDS / 2 - 1, 0, NUM_COLORS * 256 - 1);
        leds[NUM_LEDS / 2 - i - 1] = leds[NUM_LEDS / 2 + i] = ColorFromPalette(oceanPalette, index + hue);
      }

      // Increment the hue to create the moving gradient effect
      hue -= 5;

      // Show the LED colors
      FastLED.show();
    } else if (CH6 >= 1400 && CH6 <= 1600) {
      // Do nothing for now
      for (int i = 0; i < NUM_LEDS; i++) {
        leds[i] = CRGB::White;
      }
    
      // Show the LED colors
      FastLED.show();
      Serial.println("CH6 SW2");
    } else if (CH6 >= 1900 && CH6 <= 2100) {
      // Do nothing for now
      FastLED.clear(true);
      Serial.println("CH6 SW3");
    } else {
      // Display error message if CH6 is not recognized
      digitalWrite(LED_PIN, LOW);  // Turn off LED strip
      delay(500);
      digitalWrite(LED_PIN, HIGH);  // Turn on LED strip
      delay(500);
      Serial.println("LED Strip data error: check channel and pin connection");
    }
  } else if (CH5 >= 1900 && CH5 <= 2000) {
    digitalWrite(LIGHT_PIN, LOW);  // Turn off lightbulb
    FastLED.clear(true);           // Turn off LED strip
  } else {
      digitalWrite(LIGHT_PIN, LOW);  // Turn off lightbulb
      delay(500);  // Wait for half a second
      digitalWrite(LIGHT_PIN, HIGH);  // Turn on lightbulb
      delay(500);  // Wait for half a second
      Serial.println("LED Strip data error: check channel and pin connection");
    }

// Print channel receiver inputs to serial monitor
Serial.print("CH5: ");
Serial.print(CH5);
Serial.print("\tCH6: ");
Serial.println(CH6);

// Wait for a brief period before reading again
delay(100);
}

User Experience

What would it look like to use the rover as a user?

The rover will be able to operate wirelessly through a radio RC that is similar to a FPV drone controller. Both the velocity and direction of the rover can be altered, as well as toggling the onboard LED lights for better visibility and visual appeal at nighttime. More details for the RC can be viewed in the linked website, but otherwise it has around 500m of range. Additionally, the user will also be able to view the rover as a first-person perspective with the onboard GoPro streaming RTMP to the Raspberry Pi on a monitor (already owned).

Real Life Applications

In terms of applications, this rover has a wide range of potential uses. It could be used in search and rescue operations, where it could access areas that are difficult or impossible for human rescuers to reach, such as flooded areas or swamps. For example, follwing the semi-recent event of the Thailand cave rescue mission where few cave divers were stranded in an enlosed cave, this rover could be used to converse with the stranded divers and giving them support given further development of the rover such as full-body waterproofing. Additionally, the rover could be used in scientific research, such as for collecting water samples or monitoring aquatic habitats. The rover could also be used in the field of exploration, such as inspecting and traversing hard to reach areas like underground caves, rocky terrains, or else remote island.

Budget

ProductSupplier/LinkCost
Ardunino MegaMega has more pinouts for ease of use$45.76
RPi SD CardFor RC controller and WIFI RC comms$17.94
Motor1000KV Underwater Brushless Motor$13.35
Brushless Driver1pcs FVT LITTLEBEE BLlheli SPRING 30A$5.72
Power DistributePower Distribution Board with BEC 12V$2.38
Battery Pack1500mah 120C RC Battery (Li-Po)$31.34
RC TransmitterFlySky 6CH Radio Transmitter+ Reciever$66.35
Waterproof Servo25KG Digital Servo Full Metal Gear$11.75
LiPo ChargerMulti-Function LIPO Balance Charger$20.36
WiFi ExtenderFor extending GoPro video feed to RC$13.50
LiPo IndicatorLiPo Voltage Indicator LED Display$1.67
LED DecorationsWS2812b Serial Adressable LED Strips$7.18
Casing +FilamentEstimated cost for 3D Printing1$11.44
Total before taxBEFORE Tax + Delivery Fees$237.30
Delivery FeesShopee: $1.26 Per Item x12 items =$15.12
TOTAL COST$263.86

Thank you so much to everyone at the HackClub and the community for this amazing opportunity!

(I don’t have a 3D Printer so I will have to rent) Prices are converted from MYR to USD from Google.. Please allow +- few dollars differ 

Categories
DevLogs

WHW HackClub 2023 Components

Components | Part Two

  • Arduino Mega
    • Used for onboard peripheral management to control the motors and PWM from the RC input. Mega is used instead of other boards such as Uno or Nano because of the additional pinouts and flash memory size.
  • RPi SD Card
    • I already have a Raspberry Pi, I just need an SD card in order to flash the OS. The Raspberry Pi will be used as an RTMP client such as OBS. It will get a live feed from the onboard GoPro that I will attach (I already own).
  • Motor
    • The motor will be the source of velocity power and will need to be waterproof hence the underwater motor. It will be controlled with the RC input via the Arduino Mega.
  • Brushless Driver
    • Used for controlling the above motor from the low current of Arduino PWM to the higher current level of less than 30 amps of the motor.
  • Power Distribution Board
    • As the name suggests, this component will take the battery pack’s incoming voltage and distribute it accordingly to the various components onboard the craft, namely the Arduino, servo rudder, and the motor.
  • RC Transmitter
    • The remote control will serve as a input source for the user and will communicate with the Arduino via radio with the included radio receiver.
  • Waterproof Servo
    • This servo will be attached with the rudder (included in manufacturing cost) and provide the yaw movement from the bow and stern of the ship. A key piece of information is that the motor will be stationary to minimise capsizing.
  • LiPo Charger
    • This will be used to charge the LiPo battery that powers the entire marine vessel.
  • WiFi extender
    • A GoPro (already owned) will transmit a live RTMP feed to the user through Raspberry Pi, and since it is transmitted via WiFi, a WiFi extender will be needed to boost the range of the signal as the GoPro wifi signal after prior testing is weak.
  • LiPo Indicator
    • This cheap (albeit very useful) LED display will be connected to the Arduino to be able to constantly monitor remaining battery to prevent the watercraft from being stranded. The user will also be able to see this information when operating remotely via RC through the GoPro feed, the display will be strategically placed in the viewing angle of the camera.
Categories
DevLogs

WHW HackClub 2023 Introduction

As an engineer and electronics enthusiast, I am excited to propose an ambitious project: an Arduino-powered RC amphibious rover. This unique device will feature a modular design that allows it to traverse both land and water, making it highly versatile and adaptable to a wide range of environments.

The rover will be built using an Arduino microcontroller, a variety of sensors, and waterproof motors and hardware to enable it to move through water. I plan to use readily available components, however the entire project will be new and original, leaving myself to experiment with new concepts rather than following a strict tutorial.

Plan

  • Research and gather all necessary components: This will include an Arduino microcontroller and RC controller, motors, sensors, and waterproofing materials such as sealant and plastic enclosures. Links to suppliers and estimated costs are be listed below.
  • Design the rover’s chassis: Create detailed drawings of the rover’s physical design, including dimensions and mounting points for all components.
  • Acquire materials and build the chassis: Purchase materials, such as plastic sheet or aluminium, needed to construct the rover’s chassis and build it according to the design.
  • Waterproof the electronic components: Ensure through testing that only the waterproof components are submerged into water.
  • Install the electronic components: Mount the Arduino microcontroller, motors, and sensors onto the chassis and wire them together according to the circuit diagrams.
  • Write and upload the control software: Use the Arduino programming language to write the control software for the rover and upload it to the microcontroller.
  • Test the rover: Perform initial tests on the rover to ensure that all components are functioning correctly and that the rover can move on both land and water as intended.
  • Make adjustments and improvements: Based on the results of the initial tests, make any necessary adjustments or improvements to the rover’s design or software.
  • Repeat testing and finalise the design: Perform final tests to ensure that the rover is fully functional and reliable, and make any final adjustments as needed.