|
Post by Ben MnSGC on Apr 25, 2016 17:51:11 GMT -7
Could someone post instructions for setting up a arduino for the ground station? I don't want to mess up the RTC. Thanks.
|
|
|
Post by Dylan MSGC on Apr 25, 2016 17:56:08 GMT -7
When you say Raspberry Pi are you meaning Arduino Uno?
If so:
There should be a GPS shield installed on the Arduino. The two position switch should be on Software instead of Direct, and the IMU should be plugged into the shield, interfacing with A4 and A5 in the I2C orientation. Upload this code to the arduino and you should be good to go. This code is also available in the MSGC Project Box -> Ground Station System -> GroundStation_UNO_v1
#include <Adafruit_GPS.h> #include <SoftwareSerial.h> #include <Wire.h> #include <SPI.h> //#include <SD.h> #include <Adafruit_Sensor.h> #include <Adafruit_BNO055.h> #include <utility/imumaths.h> #include <avr/sleep.h>
#define LOG_FIXONLY true //If enabled will only log when GPS has a fix #define chipSelect 10 //Sdcard pin 10 for both Mega and Uno #define BNO055_SAMPLERATE_DELAY_MS (100) Adafruit_BNO055 bno = Adafruit_BNO055(55); SoftwareSerial mySerial(8, 7); //Uncomment this line if using Uno rather than Mega Adafruit_GPS GPS(&mySerial); boolean usingInterrupt = true; const int numReadings = 11; //Number of readings before averaging float readings[numReadings]; int xvalues = 0; float total = 0; float average = 0; int bad = 0; #define GPSECHO false
void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(10, OUTPUT); if(!bno.begin()) { /* There was a problem detecting the BNO055 ... check your connections */ Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!"); while(1); } GPS.begin(9600); delay(500); bno.setExtCrystalUse(true); GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA); GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ); GPS.sendCommand(PGCMD_ANTENNA); useInterrupt(usingInterrupt); delay(100); }
// Interrupt is called once a millisecond, looks for any new GPS data, and stores it SIGNAL(TIMER0_COMPA_vect) { char c = GPS.read(); #ifdef UDR0 if (GPSECHO) if (c) UDR0 = c; #endif }
void(* resetFunc) (void) = 0;//declare reset function at address 0
void useInterrupt(boolean v) { if (v) { OCR0A = 0xAF; TIMSK0 |= _BV(OCIE0A); } else { TIMSK0 &= ~_BV(OCIE0A); usingInterrupt = false; } }
uint32_t timer = millis();
void loop() { // put your main code here, to run repeatedly: sensors_event_t event; //Get IMU position uint8_t system, gyro, accel, mag; system = gyro = accel = mag = 0; bno.getCalibration(&system, &gyro, &accel, &mag); bno.getEvent(&event); Serial.print("~"); Serial.print(","); Serial.print(GPS.latitudeDegrees,7); Serial.print(","); Serial.print(GPS.longitudeDegrees,7); Serial.print(","); Serial.print(GPS.altitude * 3.28084); Serial.print(","); Serial.print(event.orientation.x,2); Serial.print(","); Serial.print(system); Serial.print(","); Serial.print(gyro); Serial.print(","); Serial.print(accel); Serial.print(","); Serial.println(mag); delay(500); if (!usingInterrupt) { char c = GPS.read(); if (GPSECHO) if (c) Serial.print(c); } if (GPS.newNMEAreceived()) {
if (!GPS.parse(GPS.lastNMEA())) return; } }
|
|
|
Post by Ben MnSGC on Apr 25, 2016 18:09:36 GMT -7
Do we still have to download the "ATmega328 on a breadboard" board for the IDE?
|
|
|
Post by Dylan MSGC on Apr 25, 2016 18:12:37 GMT -7
Do we still have to download the "ATmega328 on a breadboard" board for the IDE? No you can use these settings: Arduino/Genuino Uno Select the appropriate COM port for "Port"Then use Upload instead of Upload using Programmer (also the arrow button) Edit: It will actually upload fine if you use the Atmega328p on a breadboard but it is not the preferred way to do it.
|
|
|
Post by Ben MnSGC on Apr 25, 2016 18:22:01 GMT -7
Great thanks!
|
|
|
Post by Ben MnSGC on Apr 28, 2016 8:31:20 GMT -7
Do we still have to download the "ATmega328 on a breadboard" board for the IDE? No you can use these settings: Arduino/Genuino Uno Select the appropriate COM port for "Port"Then use Upload instead of Upload using Programmer (also the arrow button) Edit: It will actually upload fine if you use the Atmega328p on a breadboard but it is not the preferred way to do it. When I try to upload with USBtinyISP I get the following error: avrdude: Error: Could not find USBtiny device (0x1781/0xc9f What am I doing wrong?
|
|
|
Post by David MSGC on Apr 28, 2016 15:03:23 GMT -7
If you are uploading a program to the Arduino you do not need to use the programmer. Connect straight to the Arduino using the USB a male cable and USB port on the Arduino and use Dylans suggested settings. You can program the Arduino with the programmer but it is kinda redundant and not recommended. If you are programming anything with the USBtinyISP you will have to use the 2x3 ISP header, and select "upload with programmer." If you still get the error make sure the computer can see the programmer by going into the device manager on your PC and there should be an entry named "libusb-win32 devices" expand this entry and it should show USBtiny. If not, first try to unplug and replug the programmer into the computer. Sometimes I have had to close and open the Arduino IDE but this is pretty rare. Or if the programmer has never been used with the computer you may have to install the USBtinyISP drivers.
|
|
|
Post by CofC-HiBal on Sept 14, 2016 10:42:18 GMT -7
Ground station/ spider question:
I plug in the com ports and click update settings. The gui pops up.
Upon updating settings, I cannot seem to get the lat/long for my ground station to materialize in the ground station data box. Though, GPS data IS materialized above it in the incoming GPS data box.
Does my issue stem from miss calibration of the imu? I have tried recalibration without any luck... thanks in advance
|
|
|
Post by Skylar MSGC on Sept 14, 2016 19:44:04 GMT -7
Hey CofC-HiBal, You could always check the GPS settings induvisually to see if you can just get GPS cordinates from it without running the whole program. You should see if you can get GPS cordinates from the serial port on the Arduino To do this make sure you have the arduino IDE installed, open it. Make sure that you have the correct com port selected in the menu and either hit ctl-m or the little hourglass looking thing at the top right of the IDE You should be running the default Arduino ground station code in this situation. github.com/MSU-BOREALIS/Arduino_Ground/blob/master/GroundStation_Arduino_V2.0/GroundStation_Arduino_V2.0/GroundStation_UNO_v2.0/GroundStation_UNO_v2.0.inoHere's a link if you don't have it. Also putting the Arduino outside or direct line-of-sight to the sky would be a good idea so that it can get GPS lock. Get back to us if you don't see any gps coordinates from this.
|
|
|
Post by CofC-HiBal on Sept 20, 2016 9:40:05 GMT -7
Thanks mod,
I took it outside and was able to lock coordinates. My issue is resolved!
|
|