Compare View

switch
from
...
to
 
Commits (6)
robots/little_john/telemetry/code/connecting_serial_over_bluetooth.txt 0 → 100644
... ... @@ -0,0 +1,19 @@
  1 +# How to connect to the telemetry system over Bluetooth
  2 +These notes are based on experiences with Debian 9 (Stretch). A very similar approach should work for many other Linux distributions, but not other operating systems!
  3 + * First, ensure you have all the standard Bluetooth tools installed. Most systems will have installed these by default.
  4 + * Pair the Bluetooth module with your computer, with reference to the following details, (Common GUI tools are sufficient for this)
  5 + * MAC Address: 00:14:03:06:44:7C
  6 + * Name: Little_John
  7 + * Passcode: 3141
  8 + * In a terminal, run "rfcomm connect rfcomm0 00:14:03:06:44:7C" to connect the device to a virtual serial port. (Check you have sufficient permissions for this)
  9 + * There is now a serial port at /dev/rfcomm0, configured for 115200 / 8N1. This can be used like any other serial port.
  10 +
  11 +# Configuring the Bluetooth module
  12 +This should only need doing infrequently, and is well documented on the web. The key points are:
  13 + * Use an Arduino running the serial-forwarding code in this repo to bridge between the hardware and software serial ports.
  14 + * While powering the module up, pull the "EN" pin High to enter configuration mode
  15 + * While in this mode, the module runs at 38400 Baud
  16 + * Commands must end with both \r and \n
  17 + * Sending "AT" should produce the response "OK"
  18 +If in doubt, try visiting http://www.techbitar.com/modify-the-hc-05-bluetooth-module-defaults-using-at-commands.html
  19 +
... ...
robots/little_john/telemetry/code/monitor/colours.pyc
No preview for this file type
robots/little_john/telemetry/code/monitor/graph_plotter.py
1   -#!/usr/bin/env python
  1 +#!/usr/bin/env python2
2 2  
3 3 import pyglet
4 4 import math
... ... @@ -6,14 +6,18 @@ import random
6 6 import time
7 7 import serial
8 8  
9   -datafeed = serial.Serial(
10   - port='/dev/ttyUSB0',
11   - baudrate = 9600,
12   - parity=serial.PARITY_NONE,
13   - stopbits=serial.STOPBITS_ONE,
14   - bytesize=serial.EIGHTBITS,
15   - timeout=1
16   -)
  9 +try:
  10 + datafeed = serial.Serial(
  11 + port='/dev/rfcomm0',
  12 + baudrate = 115200,
  13 + parity=serial.PARITY_NONE,
  14 + stopbits=serial.STOPBITS_ONE,
  15 + bytesize=serial.EIGHTBITS,
  16 + timeout=1
  17 + )
  18 +except:
  19 + print("Serial port setup failure; exiting")
  20 + exit()
17 21  
18 22 red = [1, 0, 0]
19 23 green = [0, 1, 0]
... ... @@ -33,12 +37,12 @@ def drawgrid(target, xlines, ylines, xlimits, ylimits):
33 37 for xpos in range(0, target.width, target.width/xlines):
34 38 pyglet.graphics.draw(2, pyglet.gl.GL_LINES, ('v2i', (xpos, 0, xpos, target.height)))
35 39 tagtext = str(round((xlimits[1]-xlimits[0])*(float(xpos)/target.width) + xlimits[0], 1))
36   - tag = pyglet.text.Label(tagtext, font_name='Arkhip', font_size=10, x=xpos-2, y=0, anchor_x='right', anchor_y='bottom')
  40 + tag = pyglet.text.Label(tagtext, font_name='Sans', font_size=10, x=xpos-2, y=0, anchor_x='right', anchor_y='bottom')
37 41 tag.draw()
38 42 for ypos in range(0, target.width, target.height/ylines):
39 43 pyglet.graphics.draw(2, pyglet.gl.GL_LINES, ('v2i', (0, ypos, target.width, ypos)))
40 44 tagtext = str(round((ylimits[1]-ylimits[0])*(float(ypos)/target.height) + ylimits[0], 1))
41   - tag = pyglet.text.Label(tagtext, font_name='Arkhip', font_size=10, x=0, y=ypos-2, anchor_x='left', anchor_y='top')
  45 + tag = pyglet.text.Label(tagtext, font_name='Sans', font_size=10, x=0, y=ypos-2, anchor_x='left', anchor_y='top')
42 46 tag.draw()
43 47  
44 48  
... ... @@ -86,7 +90,7 @@ def poll_serial(foo):
86 90 except:
87 91 pass
88 92  
89   -pyglet.clock.schedule_interval(poll_serial, 0.01)
  93 +pyglet.clock.schedule_interval(poll_serial, 0.001)
90 94  
91 95 def drawgraph(target, xpoints, ypoints, colour):
92 96 plotline(target, xpoints, ypoints, colour)
... ... @@ -102,4 +106,4 @@ def on_draw():
102 106 window1.clear()
103 107 drawgraph(window1, xdata, y1data, green)
104 108  
105   -pyglet.app.run()
106 109 \ No newline at end of file
  110 +pyglet.app.run()
... ...
robots/little_john/telemetry/Accelerometer/H3LIS331DL_Datasheet.pdf renamed to robots/little_john/telemetry/code/robot/Accelerometer/H3LIS331DL_Datasheet.pdf
No preview for this file type
robots/little_john/telemetry/code/robot/analogread_demo/analogread_demo.ino
... ... @@ -7,9 +7,14 @@
7 7 */
8 8  
9 9 #include <math.h>
  10 +#include <SoftwareSerial.h>
  11 +
  12 +SoftwareSerial Bluetooth(3, 2); // Rx, Tx
10 13  
11 14 void setup() {
12 15 Serial.begin(9600);
  16 + Bluetooth.begin(115200);
  17 + //Bluetooth.print("Hello, wireless world!");
13 18 pinMode(13, OUTPUT);
14 19 }
15 20  
... ... @@ -17,8 +22,8 @@ void loop() {
17 22 float a0value = analogRead(A0);
18 23 float a7value = analogRead(A7);
19 24  
20   - Serial.print(a0value);
21   - Serial.print(", ");
22   - Serial.println(a7value);
23   - delay(20);
  25 + Bluetooth.print(a0value);
  26 + Bluetooth.print(", ");
  27 + Bluetooth.println(a7value);
  28 + delay(500);
24 29 }
... ...
robots/little_john/telemetry/code/robot/serial_forwarder/serial_forwarder.ino 0 → 100644
... ... @@ -0,0 +1,33 @@
  1 +/*
  2 +
  3 +AUTHOR: Hazim Bitar (techbitar)
  4 +DATE: Aug 29, 2013
  5 +LICENSE: Public domain (use at your own risk)
  6 +CONTACT: techbitar at gmail dot com (techbitar.com)
  7 +
  8 +*/
  9 +
  10 +#include <SoftwareSerial.h>
  11 +
  12 +SoftwareSerial BTSerial(3, 2); // RX | TX
  13 +
  14 +void setup()
  15 +{
  16 + pinMode(9, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
  17 + digitalWrite(9, HIGH);
  18 + Serial.begin(9600);
  19 + Serial.println("Enter AT commands:");
  20 + BTSerial.begin(38400); // HC-05 default speed in AT command more
  21 +}
  22 +
  23 +void loop()
  24 +{
  25 +
  26 + // Keep reading from HC-05 and send to Arduino Serial Monitor
  27 + if (BTSerial.available())
  28 + Serial.write(BTSerial.read());
  29 +
  30 + // Keep reading from Arduino Serial Monitor and send to HC-05
  31 + if (Serial.available())
  32 + BTSerial.write(Serial.read());
  33 +}
... ...