2021WinterTeam6

From MAE/ECE 148 - Introduction to Autonomous Vehicles
Jump to navigation Jump to search

Project Introduction

Team 6 Vehicle Winter 2021
Close up of Battery Monitor


We decided to tackle a major issue with driving a physical donkeycar - keeping the batteries alive. We have developed a way to help users monitor battery levels while driving the car, so that we can prevent pre-mature dis-operation of the batteries provided in class. Actively knowing the voltage levels will help us avoid problems with battery storage, specifically issues like storing them while they have low voltage. Active battery monitoring will also give us an instinct for how a certain length of time driving will lead to a certain amount of battery drain.

Check out our code repository here: https://github.com/JamesMcDougallJr/TritonVoltage.git

Winter 2021 Team 6 Members

James McDougall
Philip Lin
Pratik Yadav
Steve Kim

Description and Objective

In order to create a monitoring system for the batteries, we decided to split the task in two major sections 1. hardware monitoring via ADC, and 2. visualization via Terminal/localhost HTML.

Team 6 Sizzle Reel

https://drive.google.com/file/d/17O0d2S9ALS6rALG4RiW4qoYrnwq5F89t/view?usp=sharing

Github

Instructions and code found at this GitHub:
https://github.com/JamesMcDougallJr/TritonVoltage

Hardware Design

Makerspace 3d Printing / Laser Cutting

Jetson Nano Case

We printed a Jetson Nano case with lots of ventilation in the case, which also gave us access to the Jetson pins. top half bottom half

Baseplate

We had several versions of our baseplate printed, we used this one in the end due to the multiple holes, as well as streamlined shape.

Battmonbaseplate.PNG

Camera Mount

We faced particular issues in the beginning trying to figure out a good camera mount. This style of design, where we could point the camera downward, was the 1. easiest to install and 2. gave us the greatest flexibility.

Finalcammountbattmon.PNG

Operating Car with ROS

We were able to adopt an ROS package from Dominic (our TA) from his gitlab here: https://gitlab.com/djnighti/ucsd_robo_car_simple_ros and adapted parts of it to work for our vehicle. We made a few changes to throttle_client.py, lane_guidance.py, and lane_detection.py.

One thing to note when using ROS on the Jetson is to keep track of the environment. After following all of the instructions on the gitlab, for easy reference, here are the inputs to get the correct environments up.

   source /opt/ros/melodic/setup.bash 
source env/bin/activate
cd projects/catkin_ws
source devel/setup.bash

Battery Monitor

Pratik Soldering the PCB

Battery Monitor Hardware

We are using the Teensy-3.2 development board (https://www.pjrc.com/store/teensy32.html) for reading the battery voltages from the LIPO battery that is powering up the RC car. The Teensy board is powered up by the Jetson Nano's USB, which is also used for receiving the voltage data from the Teensy.

Hardware specifications for the Teensy GPIOs are as follows:

 1) ADC channels: We are using ADC channels A9, A3, and A6 for reading LIPO battery voltages line 4V, 8V, and 12V, respectively.
2) Interrupt wake-up pin: We are using pin-2 as the wake-up interrupt pin. This interrupt source is given by Jetson Nano. The interrupt is configured as a rising edge interrupt.
3) Test mode: For test mode, we need a test pin to simulate the rising edge signal from the Jetson Nano. We use pin-6 for this purpose.

The Teensy functionality is as follows:

 1) The Jetson Nano sends out a wake-up signal(Rising edge pulse) to the Teensy's pin-2 every 15 seconds.
2) Teensy's pin-2 interrupt service routine (ISR) sets a flag variable that is read in the main processing loop (MPL).
3) In the MPL, Teensy reads the configured ADC channels. We take an average of 512 ADC readings on each channel. Each ADC read is spaced with a 2 MSec delay.
4) When all the 3 ADC channels are read, we compute the corresponding voltages for 4V, 8V, 12V create a character string, and send the message over the USB to Jetson Nano.

Test mode:

 1) When test mode is toggled on, the Teensy Pin-6 generates a rising edge signal. Jumper a wire from pin-2 to pin-6 of the Teensy. This helps while firmware development and we do not need an active Jetson Nano integrated with Teensy.
2) Test mode also comes with some logging messages.

Battery monitor block diagram:

Battmonschem3.PNG


ADC calibration issues with Teensy:
We faced a few issues while configuring Teensy's ADC channels to read the LIPO battery's voltages (4V, 8V, 12V). The configuration issues were mostly related to the resistor precision, finding clean common ground, and ADC channel noise. In order to find the correct calibration values and reduce channel noise, we decided to simulate the battery voltages using a DC power supply. As mentioned previously, we are doing software filtering OR averaging on the ADC samples to reduce the channel noise. For determining a single ADC channel voltage, Teensy is programmed to take an average of 512 ADC samples (Each sample at 2 Msec delay). With this averaging and reducing the calibration loss, Teensy's ADC voltage was able to closely match with the DC power supply. We compared Teensy's read ADC voltage with the simulated LIPO battery voltage. The error plot shows the difference between Teensy's read ADC voltage and the LIPO battery voltage. With these two graphs, we were successfully able to prove that Teensy could closely map the LIPO battery voltages and therefore, can be used as a reliable source of the voltage reading. For more information on selecting averaging factor to reduce the effect of additive noise, please refer the section 3.4 of the reference [ADC Averaging Factor].

Battmoncompare.png Battmonerrorbars.png


Checking readings against voltmeter

Auto-Shut Off

We also added in the ability to auto-shutoff the car once the battery reaches a certain voltage level. The current floor to trigger the auto-shut off is 3.0 volts.

Battmoncmddisp.PNG

Visualization / Battery Monitoring

We can see below how we are visualizing the voltages of each LiPo cell from the batteries as the car runs. Here are the instructions to run the visualization, there are more thorough instructions on the GitHub page.

 1) Execute run.sh 
2) Attempts to start the clock on GPIO 12 with a 2s sleep.
3) Then it loads the teensy with the required .hex file -> generated from the .ino file.
4) Press the reset button on the Teensy when prompted.
5) Then the flask server starts to serve the voltage. You can also visit it in the browser at port 5000 if you tunnel in.
6) Start the visdom server. You must be tunneled in for this to work. `visdom -port 5001` or `python3 -m visdom.server -port 5001`
7) Start the visdom publisher, which grabs data from the voltage server and publishes it to the visdom server in the right format. `python3 client/visdom_client.py`


Battmonvoltage.png

Must Have's / Stretch Goals

Must Have's:
Battery Monitor
Visualization of Battery Monitor Output

Stretch Goals:
Other hardware diagnostics Searching for Tesla charging points on maps

References

[ADC Averaging Factor] paper used as reference for ADC.
[https://link.springer.com/article/10.1007/s00034-019-01115-z
GitHub Link
https://github.com/JamesMcDougallJr/TritonVoltage.git