Talk:MicroTrac Controller v17.10/Code: Difference between revisions

From Open Source Ecology
Jump to navigation Jump to search
(→‎ideas: new section)
 
(12 intermediate revisions by the same user not shown)
Line 2: Line 2:


*http://www.doctormonk.com/2012/05/sparkfun-venus-gps-and-arduino.html
*http://www.doctormonk.com/2012/05/sparkfun-venus-gps-and-arduino.html
**uses TX and RX pins that are already in use by the xbee. need use different pins.
**uses arduino's pin 10 for software serial
 
*https://www.jeremyblum.com/2011/02/27/arduino-tutorial-9-wireless-communication/


== ideas ==
== ideas ==
Line 9: Line 11:
*transmit continuous stream of current switch settings
*transmit continuous stream of current switch settings
*shut down if stream times out
*shut down if stream times out
*remote box could request gps coordinates by sending a "?"
**onboard could resond "¿" when ready
**remote will pause stream, onboard will broadcast gps, then continue.
== notes ==
"The Arduino Mega has three additional serial ports: Serial1 on pins 19 (RX) and 18 (TX), Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX)."
xbee uses standard TX RX on arduino, GPS uses serial too will need 19 and 18
*gross bit rate = baud rate when using 1s and 0s
**https://en.wikipedia.org/wiki/Bit_rate#Gross_bit_rate
== controller setup loop ==
:setup
::enter AT command mode
:::print "+++"
::set network ID
::read EEPROM setting
:::ATID0x909
::set destination address
== controller loops ==
:loop
::read pin for LF (left track forward)
:::if HIGH
::::add "A" to string
:::otherwise add "a"
::...
::add timout time value "n" to string
::if n = 8
:::n = 1
::else n ++;
::transmit string
:::print to serial
*read all pins and define variables
*if all 8 variables are the same as last broadcast skip serial print and start loop again
*if a variable is different broadcast new state
==xbee settingz==
broadcast power could be lowered
=== IDs and Networks ===
*network number 0909
*controller number 9091
**Serial Upper 13A200
**Serial Lower 4105E70B
*onboard number 9092
**Serial Upper 13A200
**Serial Lower 4105E711
== Optimization ==
:Currently the response time over the radio is about 1 second.
:*options to streamline xbee settings
:**might be able to reduce the number or retries

Latest revision as of 04:58, 30 October 2017

Code Examples

ideas

  • use capital letter for relay ON and lower case letter for OFF.
  • transmit continuous stream of current switch settings
  • shut down if stream times out
  • remote box could request gps coordinates by sending a "?"
    • onboard could resond "¿" when ready
    • remote will pause stream, onboard will broadcast gps, then continue.

notes

"The Arduino Mega has three additional serial ports: Serial1 on pins 19 (RX) and 18 (TX), Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX)."

xbee uses standard TX RX on arduino, GPS uses serial too will need 19 and 18

controller setup loop

setup
enter AT command mode
print "+++"
set network ID
read EEPROM setting
ATID0x909
set destination address

controller loops

loop
read pin for LF (left track forward)
if HIGH
add "A" to string
otherwise add "a"
...
add timout time value "n" to string
if n = 8
n = 1
else n ++;
transmit string
print to serial
  • read all pins and define variables
  • if all 8 variables are the same as last broadcast skip serial print and start loop again
  • if a variable is different broadcast new state

xbee settingz

broadcast power could be lowered

IDs and Networks

  • network number 0909
  • controller number 9091
    • Serial Upper 13A200
    • Serial Lower 4105E70B
  • onboard number 9092
    • Serial Upper 13A200
    • Serial Lower 4105E711

Optimization

Currently the response time over the radio is about 1 second.
  • options to streamline xbee settings
    • might be able to reduce the number or retries