$24
Objective
The main goal of this lab is to add a component to simulate the accelerator foot pedal of the system by using a load cell. The reading from the load cell will then be amplified and the resulting signal will be sent to the main controller which will then be mapped and used to vary the PWM signal that is sent to the main motor of the wheel. First, the load cell will be calibrated using an Arduino test script. The resulting calibration factor will then be stored in the main Arduino’s internal EEPROM and will be loaded and initialized upon startup for the rest of the project.
Equipment List
Arduino Mega 2560
Analog Wheatstone Bridge Load Cell
HX711 Breakout Module
Procedure
First, the circuit for the load cell is set up and the load cell, amplifier, and Arduino are connected as shown below in Figure 1. Next, an Arduino script is written to measure the weight applied on the load cell and calibrate the readings by using known weights and adjusting the calibration factor to return the desired values.
Figure 1: Circuit for Load Cell
Once the load cell is properly calibrated, it is added to the code for the main controller where the input from the load cell is constrained within a desired range of values. The resulting values are then mapped to output the PWM signal that will drive the wheel of the system. The functionality to set the desired maximum value of the load cell is added to the preexisting MATLAB GUI. This is done by adding a field in the GUI to reassign the calibration factor, which is sent from the GUI to the DAQ, and then to the main controller.
Finally, the EEPROM is added to the main controller such that it stores the user desired maximum RPM and calibration factor in specific addresses. The EEPROM functionality will include two Arduino functions, one that will read in the stored values and assign them accordingly upon startup and the another that will update the EEPROM addressed upon receipt of new values from the GUI. The EEPROM is set up using the EEPROMex library which allows a more user-friendly method of storing large values without concern for maximum space of each register in the EEPROM.
Deliverables
Arduino code
Integration of load cell and amplifier
Calibration system for reading weights in grams, settable from the GUI
Sensitivity parameter that maps load cell weight to motor speed by adjusting PWM signal
Functions that store and retrieve calibration and sensitivity parameters from EEPROM
Results
The base calibration factor acquired from experimenting with the given weights resulted in a value of -6266660. This factor was applied and tested using several different weights and the results were accurate to the nearest gram. The reading obtained from the calibrated load cell was constrained within a range of 0 to 100, where 100 is the initial maximum allowed weight and is subject to modification if desired. This range is then mapped to a range of 0 to 255 which represents the PWM signal that will be sent as output to the wheel motor to vary the motor RPM. The functionality of the EEPROM was also tested under several conditions which showed to successfully store, load, and update the calibration factor and maximum RPM values. A safety check was added to set the variables to the base values in the event that the EEPROM does not load properly.