Close

Prototyping the Electronics, Part 1

A project log for Drone Test Stand

A test stand to safely test vertical lift vehicles, measure thrust and record test conditions

peter-mccloudPeter McCloud 03/09/2015 at 02:580 Comments

Since last time I decided to go with the Trinket Pro. I ordered the six pack that comes with (3) 5V Trinket Pros and (3) 3.3V Trinket Pros. The load cell measurements will use the 5V Trinket Pro and I plan on using the 3.3V Trinket Pros for yet another project for Goliath. I also decided to have a display so that I can see the vehicle weight without having to hook up a seperate device. To do that I also purchased a 16x2 LCD and an I2C/SPI backpack for the Trinket Pro communicate with the LCD display.

Here's a photo of the Trinket Pro with the backpack, LCD and the amplifier (note that the amplifier is not connected yet)

I've also started the Arduino sketch, with the basics of the code, it's on github, but here's the code I have so far:

/*
 Test Stand Load Measurement Code
*/

// include the library code:
#include "Wire.h"
#include "LiquidCrystal.h"

// Connect via i2c, default address #0 (A0-A2 not jumpered)
LiquidCrystal lcd(0);

// Load Cell
float fs_voltage = 0.0 ;

void setup() {
  long time =0;
  int interval = 500; // Take a reading every 500ms
  
  /* Load Cell Calibaration
  TBD
  */
  // Equation from Datasheet for reading
  float excitation_voltage = 5; // V
  float fs_output_span = 20; // mV/V
  float gain = 64; //Amplifier Gain
  fs_voltage = excitation_voltage*fs_output_span*gain;
  
  // set up the LCD's number of rows and columns: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("LOAD (lbf):");
  lcd.setBacklight(HIGH);
}

void loop() {
  // Read all Load Cellss
  float loadcell_A = analogRead(0);
  float loadcell_B = 0;
  float loadcell_C = 0;
  float loadcell_D = 0;

  // Calculate load based on readings
  float load_A = loadcell_A/fs_voltage*100; // lbf
  float load_B = loadcell_B/fs_voltage*100; // lbf
  float load_C = loadcell_C/fs_voltage*100; // lbf
  float load_D = loadcell_D/fs_voltage*100; // lbf
  float total_load = load_A + load_B + load_C + load_D; // lbf
  
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(total_load);

}
With nothing hooked up to the analog inputs yet this is the result:

Yes, the display is upside down. This is due to using the proto-board wires as a temporary connection. The code is doing what I want so far. Next step is the finish wiring up the amplifier and one of the load cells, make sure it works and then make a slightly more permanent board.

Discussions