Skip to content

Instantly share code, notes, and snippets.

@erichoco
Last active August 29, 2015 14:14
Show Gist options
  • Save erichoco/5f47278a40a5acce8c36 to your computer and use it in GitHub Desktop.
Save erichoco/5f47278a40a5acce8c36 to your computer and use it in GitHub Desktop.
Explanation on Arduino part of GoMouve project

GoMouve

prototype version 0.1

This document provides a tutorial on how to set up GoMouve prototype, and explains the mechanism behind it.

Introduction

Set Up

Components

For sender and receiver, the following devices are required:

Sender
  • Arduino Uno * 1
  • XBee & shield * 1
  • GPS (with antenna) * 1
  • Barometer * 1
Receiver
  • Arduino Uno * 1
  • XBee & shield * 1
  • GPS (with antenna) * 1
  • Barometer * 1
  • 9DOF * 1
  • Servo * 2

Current models: XBee & shield, GPS, Barometer (w/o 3Vo pin), 9DOF, Servo

Wiring

The sketch of receiver gives an idea on how to wire up all components. Alt text Note:

  • Check the ports for SCL and SDA of your Arduino board

Uploading Scripts

  1. Get scripts of sender and receiver from here (each in XBee/sender, XBee/receiver)
  2. Download and import required libraries (see below)
  3. Set GPSRXPin GPSTXPin values according to circuit (GPSRXPin connects the TX pin of GPS, and vice versa)
  4. Set ports for Servos as first parameters in myservoVertical.attach(PORT_V, 500, 2400) myservoHorizontal.attach(PORT_H, 500, 2400)
  5. Upload script to Arduino board Remember to turn jumpers of XBee shields into USB mode ref
  6. Configure baudrate to 57600 for Serial Monitor

Libraries

GPS

Barometer

9DoF

Explanation

Communication Process

XBee Handshaking

  • In sender.ino:

      while (true)
      {
          Serial.print("A");
          delay(50);
          while (Serial.available())
          {
              // Serial.println("Available");
              if (Serial.read() == 'B')
              {
                  // Serial.println("Read B");
                  Serial.println("Setup finished!");
                  return;
              }
          }
      }
    
  • In receiver.ino:

      while (true)
      {
          delay(10);
          if (Serial.available())
          {
              char rec = Serial.read();
              Serial.print(rec);
              if (rec == 'A')
    
              {
                  for (int i = 0; i < 10; i++)
                  {
                      Serial.print("B");
                  }
                  return;
              }
          }
      }
    

Sending Data

Moving Camera

Sender

Receiver

Formula

TODO

  • moving camera part (barometer first, then self-calibration of receiver, and finally with GPS location)
  • optimize handshaking
  • redesign start/end protocols for each data transmission

updated by Eric Chiu 24.02.15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment