(Uni) DT021/TU821 Electric Car (Week 7, 8 & 9)

Electric Car Tractive System


TUDAUTHOR NAME: Jerico M.              STUDENT NUMBER: C15580367                COURSE: DT021A/TU821      


Week 7, 8 & 9 Objectives

basgsagdsagdsagadsgdsagsadgdsagasgsadgdsagsadgasadgasgdsagsadgadsgasgaDue to the social distancing measures required for COVID19, all campuses have been closed until the 29th of March, thus the objectives for these coming weeks have to be heavily altered, due to lack of equipment since there is no access to vital components needed for this project, thus the following objectives for this week and the following weeks have been set out below:

  1. Create an Excel spreadsheet of the LVCSS component limitations to design and spec for a 12V supply
  2. Compare, test and spec suitable temperature sensors for the BMS:
    • LM35 Temperature Sensor
    • DHT11 Temperature Sensor
    • DS18B20 Temperature Sensor
  3. Discuss and finalize CAN ID distribution with Raimonds for the signals of the EV

EV Tractive System & LVCSS Progress

asgsagdsagdsagadsgdsagsadgdsagasgsadgdsagsadgasadgasgdsagsadgadsgasgas

LVCSS Battery Supply

One of the most important objectives before campus closed was to spec a battery supply that will be used for the LVCSS, to do this, every component that will be powered by the battery was listed, along with their current and voltage limits to see what the max voltages and currents can be used for each component. The LVCSS mainly comprised of the different relays such as timer relays and automotive relays for shutdown motors, along with lamps and microcontrollers running on the system, thus Table 1 below was made:

Table 1: LVCSS Component Limits

Week 8 LVCSS Component Limits 1

Week 8 LVCSS Component Limits 2

The only issue was for the majority of the datasheets, some currents and voltages weren’t specified, thus were left blank in Table 1. Other factors influencing the selection of the battery supply were the size, weight, capacity and charging voltages/currents.

For capacity, the EV is only expected to run for 30 minutes max at a time, thus it is only required to find a battery that has enough capacity to compensate for more than 30 minutes of drive time which can also supply the LVCSS +12V at all times, since some components need a minimum of 12V to operate. In addition, the measured current drawn from the LVCSS was approximately 4.5A, thus example batteries specced were obtained below in Table 2:

Table 2: Suitable LVCSS Lead-Acid Battery Supply

Week 8 LVCSS Supply

All batteries were rated at 12V with a maximum charging voltage still within all component voltage limitations, also from looking at Table 2, they all had enough capacity to last more than 30 minutes for the EV drive time. For example for the 537-5488: Lead-Acid Battery, it has a capacity of 7Ah@20hr-rate, thus we can calculate the approximate battery life of this battery for the LVCSS:

Week 8 LVCSS Battery Life Calculation

Temperature Sensor

The next objective for this project was to test different temperature sensors suitable to measure the BMS battery temperature, the problem with the EMUS G1 Battery Cell Modules that came with the BMS was they were only clipped on to individual cell terminals, thus only measuring the outside temperature of the battery, which would result in inaccurate temperature readings, thus external temperature sensors that can be placed deeper into the BMS cells for more accurate readings was thought of, therefore different sensors were tested below.

Emus G1 BMS Cell Module A/B Type

The original sensor that the BMS came with was the Emus G1 Cell Module A/B Type, which is shown below in Figure 1. Since this is the sensor that was supposed to be originally used for the BMS temperature measurements, all the other sensor specifications will be compared to this sensor i.e. accuracy, temperature range, etc…

Week 8 G1 Cell Module A-B

Figure 1: Temperature Sensor: EMUS G1 Cell Module Type A/B

LM35 Temperature Sensor

The first sensor that was tested was the LM35 temperature sensor. Sensor pins and specifications below in Figure 2 were obtained from its datasheet. It is an analog sensor so when implementing it with the Arduino, its measurements have to be obtained using Analog to Digital Conversion (ADC). From the LM35s specifications its main advantages are its wide range and high accuracy compared to the original sensor (EMUS G1 Cell Module Type A/B), in addition, its small size will allow it to be easily installed deeper into the BMS cells, allowing for more accurate temperature measurements, with these sensors obtained, four LM35 sensors were tested via Arduino.

Week 7 LM35 Pins

Figure 2: Temperature Sensor: LM35

Following the pins of the LM35 shown in Figure 2, four LM35 sensors were connected to the Arduino, with an analog pin of the Arduino being used for each sensor, pin 1 (+Vs) of the LM35 sensors can simply be supplied with the 5V voltage of the Arduino and pin 3 (GND) of each LM35 sensor to a common ground with the Arduino, thus the circuit was connected as shown in the wiring diagram shown in Figure 3:

Week 7 Multiple LM35 Sensors

Figure 3: Four LM35 Sensors with Arduino Wiring Diagram

With the required connections made, all that was needed was to program the Arduino to measure temperature measurements from the analog pins A0, A1, A2 and A3 and display it to the serial monitor, thus the final code below was created. With this program implemented to the Arduino, temperature measurements were successfully displayed on to the serial monitor from all four LM35 sensors, with results shown in Figure 4.

/********************************************************************
– Temperature Measurements with Multiple (4) Analog LM35 Sensors
– Version 1.0
– Programme by Jerico M.
– Last Edited on 26/03/22
********************************************************************/
/*
* Two analog LM35 sensors are used to measure temperature
* The wiring for each sensor are connected as followed:
– Pin 1 (Vs) of LM35 sensors can be supplied 4 to 20V (5V from Arduino)
– Pin 2 (Vout) of LM35 sensors can be connected to any analog pin of Arduino
– Pin 3 (GND) of LM35 sensors can be connected to GND pin of Arduino
********************************************************************/

/******* Define all variables that will be used for temp. *********/
float tempC1;
float tempC2;
float tempC3;
float tempC4;
float tempdegC1;
float tempdegC2;
float tempdegC3;
float tempdegC4;
int tempPin1 = A0;
int tempPin2 = A1;
int tempPin3 = A2;
int tempPin4 = A3;

/* void setup allows to run once */
void setup ()
{
/* Start serial port to display results on screen */
Serial.begin(9600);
Serial.print(“| LM35 Sensor Measurements Started |”);
Serial.println();
Serial.println(“————————————-“);
}
/* End setup */

/* void loop allows to run continuously */
void loop()
{
/* Sensor temperature ADC calculations */
tempC1 = analogRead(tempPin1);                    // Read from A0
tempdegC1 = (5.0 * tempC1 * 100.0) / 1024.0; // A0 temp. ADC
tempC2 = analogRead(tempPin2);                   // Read from A1
tempdegC2 = (5.0 * tempC2 * 100.0) / 1024.0; // A1 temp. ADC
tempC3 = analogRead(tempPin3);                   // Read from A2
tempdegC3 = (5.0 * tempC3 * 100.0) / 1024.0; // A2 temp. ADC
tempC4 = analogRead(tempPin4);                   // Read from A3
tempdegC4 = (5.0 * tempC4 * 100.0) / 1024.0; // A3 temp. ADC

/* Print sensor measurements to serial monitor */
Serial.print(“Sensor01 temperature: “);
Serial.print(tempdegC1, 1);
Serial.println();
Serial.print(“Sensor02 temperature: “);
Serial.print(tempdegC2, 1);
Serial.println();
Serial.print(“Sensor03 temperature: “);
Serial.print(tempdegC3, 1);
Serial.println();
Serial.print(“Sensor04 temperature: “);
Serial.print(tempdegC4, 1);
Serial.println();
Serial.println(“————————————-“);
delay(1000); // 1 second delay
}
/* End main loop */
/*******************************************************************/

Week 7 LM35 Multiple Sensor Measurements

Figure 4: Four LM35 Sensors with Arduino Measurements

DS18B20 Temperature Sensor

The next sensor tested was the DS18B20 temperature sensor. Sensor pins and specifications for this sensor can be seen in Figure 5. The reason this sensor was also chosen was due to its unique applications such as each sensor having its own unique 64-bit address, making it easier to trace which sensor is which, in addition, unlike the LM35 sensor, the DS18B20 is a digital sensor, meaning that it does not need ADC, also the DS18B20 is the same size as the LM35, which makes it suitable for BMS temperature measurements. The DS18B20 sensor also uses one-wire protocol, meaning multiple sensors can be connected to a singular digital pin, minimizing wiring and components, which is an advantage over the LM35 where each sensor needs a separate pin. Although the DS18B20 temperature range  and accuracy is superior to the EMUS G1 Cell Module, the LM35 range and accuracy is still better than both the DS18B20 and Emus G1 Cell Module.

Week 8 DS18B20 Pins

Figure 5: Temperature Sensor: DS18B20

Before implementing a program into the Arduino with this sensor, the DS18B20 requires two libraries: One library for one-wire communication and the other library for temperature measurements. As mentioned before, these sensors have their own 64-bit address, using the libraries above, this address can be simply obtained. Using the pin diagram in Figure 5, one DS18B20 sensor can be connected to the Arduino as shown in Figure 6.

Week 8 Single DS18B20 Sensor.png

Figure 6: One DS18B20 Sensor with Arduino Wiring Diagram

With the appropriate connections in Figure 6 made, a program to extract the 64-bit address can be created using the DallasTemperature library as previously mentioned, therefore the program below was created and device addresses for four DS18B20 sensors were obtained shown in Figure 7, note that typical DS18B20 addresses usually look like:

0x31, 0x22, 0x3B, 0x11, 0x55, 0x00, 0x00, 0x11

/********************************************************************
– Printing Internal Addresses of DS18B20 One-Wire Sensor
– Programme from http://henrysbench.capnfatz.com/henrys-bench/arduino-temperature-measurements/ds18b20-arduino-user-manual-introduction-and-contents/ds18b20-user-manual-part-2-getting-the-device-address/
– Version 1.0
– Modified by Jerico M.
– Last Edited on 27/03/22
********************************************************************/
/*
* A DS18B20 sensor’s 64-bit address can be printed out using this code
* along with the wiring connections specified below:
– Pin 1 (GND) of DS18B20 sensors are connected to GND pin of Arduino
– Pin 2 (DQ) of DS18B20 sensors can be connected to any digital pin of Arduino
– Pin 3 (Vdd) of DS18B20 sensors can be connected to either 5V or 3.3V pin of Arduino
– 4.7k pull-up resistor connected between DQ and Vdd of DS18B20 sensors
********************************************************************/
/******* Import the needed libraries for the sensor to work ********/
#include <OneWire.h>

/*** Data wire from sensor is plugged into pin 2 of the Arduino ****/
#define SENSOR_PIN 2

/* Set up a oneWire instance to communicate with any OneWire device */
OneWire Bus(SENSOR_PIN);
/* void setup allows to run once */
void setup()
{
Serial.begin(9600);  // Start serial port to display results on screen
discoverOneWireDevices();  // Check for one-wire devices connected to Arduino
}
/* End setup */

/* void loop will not be needed for this code */
void loop()
{
}

/* Code used to print 64-bit address of the sensor address array */
void discoverOneWireDevices(void)
{
byte i;
byte present = 0;
byte data[12];
byte addr[8];

/* Search for OneWire object and read its value into the addr array declared above */
Serial.print(“Getting the device address…\n\r”);

/* Print if a device has been found and print the device address */
while(Bus.search(addr))
{
 Serial.print(“\n\r\n\r\’One-Wire\’ Device has been found with Serial Number:\n\r”);
     for( i = 0; i < 8; i++)  // Read each byte in the addr array
{
Serial.print(“0x”);
if (addr[i] < 16)
{
Serial.print(‘0’);
}
 /* Print each byte in the address array in hex format */
Serial.print(addr[i], HEX);
if (i < 7)
{
Serial.print(“, “);
}
}
 /* A check to make sure that what we read is correct */
if ( OneWire::crc8( addr, 7) != addr[7])
{
Serial.print(“CRC is not valid!\n\r”);
return;
}
}
Serial.println();
Serial.print(“Finished”);
Bus.reset_search();  // Reset search for next sensor to be used
return;
}
/*******************************************************************/

Week 8 DS18B20 Addresses.PNG

Figure 7: Four DS18B20 Sensor’s 64-bit Addresses

With the pin specifications for the DS18B20 sensor acknowledged in Figure 5, the circuit in Figure 8 was built, using four DS18B20 sensors with pin 1 (GND) connected to a common ground with the Arduino, pin 2 (DQ) connected to a digital pin of the Arduino and pin 3 (VDD) supplied via 5V from the Arduino along with a 4.7kΩ pull-up resistor between pin 2 and pin 3 of the sensor.

Week 8 Multiple DS18B20 Sensors

Figure 8: Four DS18B20 Sensors with Arduino Wiring Diagram

With the wiring diagram for four DS18B20 sensors in Figure 8 built, it can be seen that all four sensors were connected to a single digital pin since the DS18B20 is designed with built-in One-wire Communication Protocol. Again, the Arduino libraries for the DS18B20 sensors were used, and the program below was made to measure temperature from all four sensors, using the device address for the individual sensors obtained in Figure 7 in the program, thus temperature measurements from all four sensors were successfully obtained as shown in Figure 9.

/********************************************************************
– Temperature Measurements with Multiple DS18B20 One-Wire Sensor (4x)
– Version 1.2
– Modified by Jerico M.
– Last Edited on 27/03/22
********************************************************************/
/*
* Four DS18B20 sensors are used to measure temperature
* The wiring for each sensor are connected as followed:
– Pin 1 (GND) of DS18B20 sensors are connected to GND pin of Arduino
– Pin 2 (DQ) of DS18B20 sensors can be connected to any digital pin of Arduino
– Pin 3 (Vdd) of DS18B20 sensors can be connected to either 5V or 3.3V pin of Arduino
– 4.7k pull-up resistor connected between DQ and Vdd of DS18B20 sensors
********************************************************************/
/******* Import the needed libraries for the sensor to work ********/
#include <OneWire.h>
#include <DallasTemperature.h>

/* Data wire from all sensors are plugged into pin 2 of the Arduino */
#define ONE_WIRE_BUS_PIN 2

/* Set up a oneWire instance to communicate with any OneWire device */
OneWire oneWire(ONE_WIRE_BUS_PIN);

/*** Allow Dallas Temperature Library to utilize oneWire Library ***/
DallasTemperature sensors(&oneWire);

/* Giving each sensor a name by assigning the serial numbers obtained
from previous code (e.g. Sensor Name = { Serial Number of Sensor}; */
DeviceAddress Sensor01 = { 0x28, 0x50, 0x87, 0x3B, 0x0A, 0x00, 0x00, 0x1C };
DeviceAddress Sensor02 = { 0x28, 0x6E, 0x75, 0x3B, 0x0A, 0x00, 0x00, 0xC7 };
DeviceAddress Sensor03 = { 0x28, 0x22, 0x70, 0x3B, 0x0A, 0x00, 0x00, 0x1D };
DeviceAddress Sensor04 = { 0x28, 0xF7, 0x87, 0x3B, 0x0A, 0x00, 0x00, 0xC5 };
/* void setup allows to run once */
void setup()
{
/* Start serial port to display results on screen */
Serial.begin(9600);
Serial.print(“Starting up Temperature Control Library “);
Serial.println(DALLASTEMPLIBVERSION);

/* Start up the DallasTemperature library */
/* Set resolution of sensors */
// 9 bit resolution, 93.75 ms conversion time
// 10 bit resolution, 187.5 ms conversion time
// 11 bit resolution, 375 ms conversion time
// 12 bit resolution, 750 ms conversion time
sensors.begin();
sensors.setResolution(Sensor01, 10);
sensors.setResolution(Sensor02, 10);
sensors.setResolution(Sensor03, 10);
sensors.setResolution(Sensor04, 10);
}
/* End setup */
/* void loop allows to run continuously */
void loop()
{
/* Print required text to screen/serial monitor */
/* Check for no. of devices connected on bus */
delay(2000); // 2 seconds delay
Serial.println();
Serial.print(“Number of connected Devices on bus: “);
Serial.println(sensors.getDeviceCount()); // Display number of connected devices on bus
Serial.print(“Measuring temperatures from all connected sensors… “);
Serial.println();

/* Request temperature measurements from all connected DS18B20 sensors */
sensors.requestTemperatures();

/* Print sensor measurements to serial monitor */
Serial.print(“Sensor01 temperature: “);
printTemperature(Sensor01);
Serial.println();

Serial.print(“Sensor02 temperature: “);
printTemperature(Sensor02);
Serial.println();

Serial.print(“Sensor03 temperature: “);
printTemperature(Sensor03);
Serial.println();

Serial.print(“Sensor04 temperature: “);
printTemperature(Sensor04);
Serial.println();

/* DS18B20 sensor average measurements */
float Temp1 = sensors.getTempC(Sensor01);
float Temp2 = sensors.getTempC(Sensor02);
float Temp3 = sensors.getTempC(Sensor03);
float Temp4 = sensors.getTempC(Sensor04);
float TempAVG = (Temp1 + Temp2 + Temp3 + Temp4)/4;
Serial.print(” Average temperature: “);
Serial.print(TempAVG);
Serial.print(” (degC)”);
Serial.println();
}
/* End main loop */
/* DS18B20 sensor configuration for sensor measurements */
void printTemperature(DeviceAddress deviceAddress)
{

/* If sensors read -127degC it means the wiring or code is wrong */
/* Print if there’s an error, otherwise allow sensors to read temperature */
float tempC = sensors.getTempC(deviceAddress);

if (tempC == -127.00)
{
Serial.print(“Error getting temperature “);
}
else
{
Serial.print(tempC);
Serial.print(” (degC)”);
}
}
/*******************************************************************/

Week 8 DS18B20 Multiple Sensor Measurements.JPG

Figure 9: Four DS18B20 Sensors with Arduino Measurements

DHT11 Temperature Sensor

Another temperature sensor available was the DHT11 temperature and humidity sensor shown in Figure 10. From looking at the DHT11 datasheet, I knew straight away that these sensors were not suitable for BMS temperature measurements since the temperature range of the DHT11 only goes up to 50°C compared to the 80°C range of the EMUS G1 Cell Modules, therefore tests for this sensor were not carried out.

Week 8 DHT11

Temperature Sensor Conclusion

After investigating the datasheet for all sensors and using the EMUS G1 Cell Modules as the foundation of comparison, the selection of the temperature sensor was obtained via weighted factor modelling in Table 3, with the main factors being:

Application: Application for this specific weighted factor model means the sensor’s ease of use, features and advantages over the other sensors. The reason this accounts for 40% of the overall model is because certain features of each sensor can be far more advantageous compared to other sensors. Keep in mind that these sensors will be installed on an EV, so sensors such as the DS18B20 would be rated higher due to its one-wire capabilities as fewer components and wiring is required for these sensors to be installed, in addition the DS18B20 will only be using one digital pin on the Arduino, whereas if the LM35 sensors were to be used, up to four of my Arduino’s analog pins will be used, which is a disadvantage, since I might need these pins for future use. In addition, the DS18B20 allows for customizable resolutions between 9bits to 12bits whereas the other sensors would only allow for a fixed resolution such as 10bits, with all these taken into consideration the DS18B20 was rated the highest due to its better features.

Accuracy: Although accuracy is also a very important factor, for this project, accuracy of the temperature sensors won’t be as important as the applications of the sensors, thus it is only worth 20% of the model, although keep in mind that the accuracy is still very important for this system. From looking at the datasheet for each sensor, the average accuracy was ±0.5°C for all sensors, except the LM35, where it can have up to ±0.75°C accuracy, making it the sensor with the best accuracy, giving it the highest points.

Range: The range was based on both the overall range of the sensor and its range compared to the original sensor which is the EMUS G1 Cell Module. The following ranges for each sensor are as follows:

  • EMUS G1 Cell Module A/B Type: -40°C to 80°C
  • LM35: -55°C to 150°C
  • DS18B20: -55°C to 125°C
  • DHT11: 0°C to 50°C

The LM35 both covered the EMUS G1 Cell Module’s range and had the largest temperature range, thus it was given the highest rating, this was followed by the DS18B20 sensor since it also covers the temperature range of the cell modules and the DHT11 was given the lowest rating due to its small temperature range of only up to 50°C.

Cost: The next criteria the model was based on is the cost, using the main websites of RS Components and Farnell, prices were compared between each sensor, with availability for order and the available stock in campus. With both the LM35 and DS18B20 only costing less than €2, they were rated closely, whereas the DHT11 cost much more.

Size: The final criteria the model was graded on was the size, this is also important since the right size is needed to fit into the BMS cells for more accurate temperature measurements compared to the cell modules. Since the LM35 and DS18B20 are almost exactly the same size, thus they were given an equal rating. The DHT11 was much bigger in size in terms of length and width, which would be too big to be fit between the BMS cells, thus it was given the lowest rating. The cell modules were also fairly big, but compared to all of the other sensors, it has the smallest width and can be installed on to the BMS cells with a good fit, the only problem is it has a very long length, which is a disadvantage compared to the LM35 and DS18B20.

Table 3: Temperature Sensor Selection: Weighted Factor Model

Week 8 Temperature Sensor Selection


Week 7, 8 & 9 Objectives Checklist

asgsagdsagdsagadsgdsagsadgdsagasgsadgdsagsadgasadgasgdsagsadgadsgasgasRed = Incomplete               Green = Complete

  1. Create an Excel spreadsheet of all LVCSS component limitations to design and spec for a 12V supply
  2. Compare, test and spec suitable temperature sensors for the BMS:
    • LM35 Temperature Sensor
    • DS18B20 Temperature Sensor
    • DHT11 Temperature Sensor
  3. Discuss and finalize CAN ID distribution withRaimonds for the signals of the EV

Leave a comment