Showing posts with label CAN Bus. Show all posts
Showing posts with label CAN Bus. Show all posts

Sunday, 28 June 2015

(Vacation) WEEK TEN: 22 June to 28 June 2015

Task 1: CANBUS - Ethernet Testing

The Ethernet Shield was tested in order to verify that communication can be done in the CAN bus system.

We tested the Ethernet shield to check if we can connect the Arduino to a specific IP address. Therefore, when we key the IP address of the Arduino code into our web browser, we would be able to see the readings for the analog pins.

The IP address would be of a similar range to the IP address of the router that we are using. The figure below would show the results that we have obtained from testing the Ethernet Shield

Figure 1. Ethernet Shield Testing Results


Task 2: Logging GPS Coordinates

This week, we managed to get the GPS module EM406 talking to the satellite. Testing was done at various locations to ensure that the GPS coordinates are accurate. The accuracy of GPS module depends on the location that we are at. It was difficult to obtain accurate coordinates indoors as the satellite was not communicating well with EM406. Thus, It would show an "INVALID" on our serial port as shown below. 

Figure 2. GPS Tracking Program and Serial Output
We were able to obtain the accurate readings once we are in open air and the module is communicating with the satellite. When moving, the coordinates also changes. The date and time logged by the GPS module is GMT timing. This means that during the actual race, we would have to convert the time to Australia timing. 

In order to get the GPS program to run, the tinyGPS++ library have to be installed. Appendix is our program for testing the module. 

#include <TinyGPS++.h> //include this library for the GPS to work
#include <SoftwareSerial.h> //this is the GPS software serial library

// Choose two Arduino pins to use for software serial
// The GPS Shield uses D2 and D3 by default when in DLINE mode
int RXPin = 2;
int TXPin = 3;

// uses 4800 baud by default
int GPSBaud = 4800;

// Create a TinyGPS++ object called "gps"
TinyGPSPlus gps;

// Create a software serial port called "gpsSerial"
SoftwareSerial gpsSerial(RXPin, TXPin);

void setup()
{
  // Start the Arduino hardware serial port at 9600 baud
  Serial.begin(9600);

  // Start the software serial port at the GPS's default baud
  gpsSerial.begin(GPSBaud);

  Serial.println(F("DeviceExample.ino"));
  Serial.println(F("A simple demonstration of TinyGPS++ with an attached GPS module"));
  Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
  Serial.println(F("by Mikal Hart"));
  Serial.println();
}

void loop()
{
  // This sketch displays information every time a new sentence is correctly encoded.
  while (gpsSerial.available() > 0)
    if (gps.encode(gpsSerial.read()))
      displayInfo();

  // If 5000 milliseconds pass and there are no characters coming in
  // over the software serial port, show a "No GPS detected" error
  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
    Serial.println(F("No GPS detected"));
    while(true);
  }
}

void displayInfo()
{
  Serial.print(F("Location: ")); 
  if (gps.location.isValid())
  {
    Serial.print(gps.location.lat(), 6);
    Serial.print(F(","));
    Serial.print(gps.location.lng(), 6);
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F("  Date/Time: "));
  if (gps.date.isValid())
  {
    Serial.print(gps.date.month());
    Serial.print(F("/"));
    Serial.print(gps.date.day());
    Serial.print(F("/"));
    Serial.print(gps.date.year());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F(" "));
  if (gps.time.isValid())
  {
    if (gps.time.hour() < 10) Serial.print(F("0"));
    Serial.print(gps.time.hour());
    Serial.print(F(":"));
    if (gps.time.minute() < 10) Serial.print(F("0"));
    Serial.print(gps.time.minute());
    Serial.print(F(":"));
    if (gps.time.second() < 10) Serial.print(F("0"));
    Serial.print(gps.time.second());
    Serial.print(F("."));
    if (gps.time.centisecond() < 10) Serial.print(F("0"));
    Serial.print(gps.time.centisecond());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.println();
}

We hope to get GPS coordinates and have it displayed on DAQ so that we can save the file for analysis. 

Sunday, 7 June 2015

WEEK SIX/SEVEN: 25 May to 7 Jun 2015

Task 1: CAN Bus
Figure 1. CAN Bus Shield, Arduino compatible
Our team tried to program the CAN Bus shield this week with a simple program found in the arduino library. CAN Bus is important as it allows us to communicate with parts of the system such as the battery management system. At the same time, CAN Bus shield also has the ability to log data, which enables us to so that we could allow the arduino to be CAN Bus compatible and the ability to communicate and log data from the rest of the system. The CAN Bus shield can just be placed above the arduino for compatibility use. This CAN Bus shield has a RS232 input socket which will allow it to transmit data using a cable. It also has a memory card slot which will allow it to log data accurately. Due to the fact that the data transmitted is by wireless, there is a possibility that data may be lost along the way. The memory stick can be used as a backup as well as cross checking the data recorded by the chase vehicle.




Task 2: RF Modem


Figure 2 (a). XStream Modem 
Figure 2(b). Xbee Modem

RF Modem is used for wireless transmission of data from the solar vehicle to our chase vehicle. Modems used come from Xbee(Fig 2)  and Xtreme(Fig 1). When doing past technical testing, the Xtreme performs more reliably than the Xbee. The Xtreme covers a further range compared to the Xbee modem, although Xbee is stated to have a further range than the Xtream modem. Thus,in 2013, the Sunspec 3 uses the Xtreme modem. Like wise, for 2015, we will be using Xtreme for Sunspec 4.

Configuration of the xstream modem is via the software X-CTU. It can be installed with a disk that comes with xstream modem, while having the modem plugged into your computer. This is the first testing that we did indoors at T10 level 2. The software PuTTY is a window to see the received data. Otherwise, the "terminal" tab can also see the transmitted data. 

Figure 3 (a). Testing of xstream modem when staying still
Figure 3(b). Terminal Tab of X-CTU

Then, our team brought the transmission outdoors. We headed to 11 Square and get the modems tested out with one of the modems moving away.

Melvin & Siti Staying put
Jingwen, Dzul & En han bringing the modem for a walk :D

Here's the result!
Figure 3(b). Testing of xstream modem while walking
The transmission is successful and signal was not blocked when we moved behind the pillar. 
Now we would need to get the Xstream to talk to the arduino!