Tech, music, and more

Category: Maker Blog

Part 3: First Autonomous Mapping Tests

For the past two weeks, I have been working on building an autonomous drone to run mapping missions. I connected two Raspberry Pis to the drone to take pictures using the Raspberry Pi Cam v2. I ran into several issues with my receiver not connecting and GPIO pins not triggering, but I managed to come up with workarounds for each problem. I used the Ardupilot Mission Planner software to operate the drone: https://ardupilot.org/planner/.

Parts list

Total Cost: $887

Setup

Here is a quick breakdown of the build setup.

Completed Build
NoIR cam and RGB Camera
Inside look at raspberry pi wiring

The Pololu 5v 5.5 A voltage regulator provides power to the servo rail on the flight controller and both Raspberry Pis (4b and Zero W). This voltage regulator has an XT30 plug and is powered off of a LiPo battery that is separate from the one that powers the drone. The flight controller connects to the Pi 4B’s GPIO and has a camera trigger. The Pi 4B (with LTE HAT attached on top right) provides power to the Zero W. I also connected one of the 4B’s GPIO pins to the Zero W to act as a secondary camera shutter relay. The Pi 4B is attached to the NoIR camera and the Zero W is attached to the RGB camera.

Stay tuned for another blog post with a more in-depth technical breakdown of the drone build.

Testing Highlights

Watch this video:

Map Construction

The test flights were a success and the cameras were a partial success. My RGB camera was slightly out of focus for the tree pictures. I also set the angle incorrectly on Mission Planner so the images did not have enough overlap. I still gave it a go using the auto image merge in photoshop (aka the Brenizer Method): https://digital-photography-school.com/5-steps-to-rock-the-brenizer-method/

The results are promising. The top left image is from the first test flight of a field, which looks pretty good. After that first flight, I ran another test flight above the trees. The tree images in the second flight got fractured into separate parts, which means I need to take more images during each flight.

Future Plans – Short Term

Now that I trust the drone to fly over trees on its own, I am going to set up another, longer mapping mission where I look at some diseased beech trees.

I am also going to set up the raspberry pi’s to automatically start run the python programs at boot using systemd.

Then I’ll geotag the images and put it into photogrammetry software (webODM) to construct a map from the images. I’m also going to lower the resolution of the RGB photos because the Zero W is a slower at taking pictures so it often misses picture triggers and is out of sync with the 4B.

Future Plans – Long Term

I want to get the 4G telemetry working on the raspberry pi. The raspberry pi can send telemetry data from the drone directly to my laptop so that I do not need to use the telemetry radios. However, I have to set up port forwarding and I have not had access to a router to do so. I have an idea to use a sim card router and set up dynamic DNS…stay tuned.

Tutorials I am using:

Raspberry Pi Pixhawk drone: https://www.youtube.com/watch?v=kB9YyG2V-nA

Setting up Telemetry over 4G: https://www.youtube.com/watch?v=IokyotAGbJI

Using port forwarding on a https://www.youtube.com/watch?v=2d5HfU39tyM

The PicoGamer Glove

I recently got a Raspberry Pi Pico W because I wanted to try out making wearable technology. The Pico is a microcontroller similar to an arduino. I like the Pico because I can program it using Python.

I recreated alien invaders using java for my final class project. I wanted to add a more immersive experience to playing the game. I did some research into microcontrollers that can emulate Human Interface Devices (HID). Joysticks, keyboards, and mice are some examples of HID devices. There are HID libraries for the Pico that enable it to emulate a keyboard, joystick, and even multimedia controls. Each finger acts as a momentary switch that is triggered when it comes into contact with my thumb.

List of Materials

To build this glove, I used the following:

  1. Raspberry Pi Pico – $4 or Pico W – $6:
  2. Headers for the Pico (alternatively, you can buy a Pico with the headers pre-soldered, but where’s the fun in that?)
  3. Inertial Measurement Unit (IMU) MPU 6050 – $13
  4. Jumper Wires
  5. Soldering iron
  6. Solder
  7. Aluminum Foil
  8. Tape
  9. Old Glove
  10. Scissors
  11. Needle and Thread

All of the code and libraries I wrote/used are on this Github repository: https://github.com/Bobcati/pico-glove-rev1

Building the Glove

Cut five pieces of aluminum foil with the dimensions of about 2 cm by 12 cm. Take 4 jumper wires of any color other than red or black and strip about 1 cm of insulation off. Do the same for 4 black jumper wires. For the black wires, tape all four of them onto one strip of aluminum foil. For the other four wires, tape each of the exposed wires to a strip of aluminum foil like so:

Wrap the tin foil strip with the black wires around the thumb. Then wrap each tinfoil piece around a finger on the glove.

Sew the MPU6050 IMU onto the back of the glove using a needle and some black thread.

On the MPU6050, attach a yellow jumper wire to the SCL pin, a white wire to the SDA pin, a red wire to the VIN pin, and a black wire to the GND pin.

Connect each finger to the corresponding GPIO pin on the Pico. The ring finger should attach to GP6, the pointer finger to GP9, the pinky finger to GP21, and the middle finger to GP2. Connect each of the black wires attached to the thumb to the GND pins closest to each GPIO pin the finger wires are plugged into.

Take the MPU6050 and connect the SCL (yellow) to GP15 and SDA (white) to GP14 on the pico.

Setting up the Pico

I had to install the CircuitPython firmware to use my pico with the Adafruit libraries. Adafruit is a great company that builds every sensor or HAT imaginable for SBC or microcontroller related projects.

Hold down the BOOTSEL button on your Pico while plugging it in to a computer.

For the regular Pico, download the CircuitPython firmware here: https://circuitpython.org/board/raspberry_pi_pico/

For the Pico W, download the CircuitPython firmware here: https://circuitpython.org/board/raspberry_pi_pico_w/

Watch this video…

or follow along with this tutorial to install the firmware (skip the first step – the firmware is already downloaded): https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/circuitpython

In order to make the Pico function as an HID device and read sensor input from the MPU6050, I had to add several libraries to the Pico. Every Pico has a “lib” folder, where all of the libraries must be stored. The Pico acts like an external USB flash drive when it is plugged into a computer labeled “CIRCUITPY.” Download the files from my github repository and paste them into the “CIRCUITPY” drive.

Et Voila: when the Pico is connected to the computer, the arrow keys will be triggered depending on hand tilt and tapping the thumb and pointer finger together will trigger the space key.

Tapping the pinky switches to manual mode, where the middle finger becomes the right arrow key and the ring finger becomes the left arrow key.

To edit programs on the Pico, download either the Thonny IDE: https://github.com/thonny/thonny/releases/tag/v4.1.1

or the Mu code editor:

https://codewith.mu/

© 2024 sukkendi

Theme by Anders NorenUp ↑