Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1b9db32
Initial commit
Victor-Pham Nov 17, 2019
eeb8b87
Telemetry Website
Victor-Pham Nov 17, 2019
6aa5649
Added requirements.txt
Victor-Pham Nov 17, 2019
51e3dcf
Updated chart to be dynamic
Victor-Pham Nov 21, 2019
0619ba7
Update battery.html
jtkim03 Nov 21, 2019
dd7442e
modifying documentation
sandeshworld Nov 21, 2019
844519d
Added solar page
Victor-Pham Nov 24, 2019
fb2523d
Battery page update
jtkim03 Nov 24, 2019
4d13e88
Update README.md
Victor-Pham Nov 24, 2019
20c4d68
Random number updating
jtkim03 Jan 19, 2020
3e408c3
Update solar page
Victor-Pham Jan 19, 2020
f0f0769
Created object to handle data
Victor-Pham Jan 19, 2020
18aed9b
Implemented interactive graph, logging data to file
Victor-Pham Feb 4, 2020
a2f601d
Small UI update
jtkim03 Jan 21, 2020
cc7265d
Added Xbee receiver code
Victor-Pham Feb 16, 2020
047f6d6
battery page update, graph.html, control.html
jtkim03 Feb 23, 2020
9cc6377
Dygraphs and faults page implementation
jtkim03 Mar 1, 2020
3ed67d1
Updated client.js
Victor-Pham Feb 25, 2020
f0aed9a
ArduinoJson MessagePack file
drcall Feb 25, 2020
0b99c80
Updated battery page
Victor-Pham Mar 1, 2020
68e409c
Implemented local storage
Victor-Pham Mar 1, 2020
83aba70
faults page update
jtkim03 Mar 1, 2020
ade5c7e
Implemented sqlite db
Victor-Pham Apr 5, 2020
09b7dba
Create db file
Victor-Pham Apr 5, 2020
efc366a
Update requirements.txt
Victor-Pham Apr 5, 2020
87d4484
BMS Database model
jtkim03 Apr 19, 2020
ef8b2f4
Delete glibc.cpython-37.pyc
jtkim03 Apr 19, 2020
2980a2a
KLS model
jtkim03 Apr 19, 2020
521576f
models updated to hold correct value types
jtkim03 Apr 22, 2020
870d1b8
socat fake serial port server done
sandeshworld Apr 20, 2020
aa0e593
prob conflicts here
sandeshworld Apr 20, 2020
468a89e
new libraries needed
sandeshworld Apr 20, 2020
154113d
primary key
jtkim03 Apr 22, 2020
c3828a5
motor fautls
TamerTimraz Feb 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 11 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
.pnp
.pnp.js

# testing
coverage

# production
build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
*.pyc
.Python
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
.venv
pip-selfcheck.json
node_modules/
94 changes: 94 additions & 0 deletions MsgPackXBee.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Solar Car @ UVA | Telemetry
// 23 February 2020

#include <ArduinoJson.h>
#include <SoftwareSerial.h>

#define rX 7
#define tX 8

SoftwareSerial xbee = SoftwareSerial(rX,tX);

const int capacity = JSON_OBJECT_SIZE(54);

StaticJsonDocument<capacity> telemetryData;

void changeDoc() {
// Timestamp
telemetryData["t"] = millis();

// BMS numbers
telemetryData["ba"] = (float)random(25,30);
telemetryData["bb"] = (float)random(80,100);
telemetryData["bc"] = (float)random(90,100);
telemetryData["bd"] = random(65,70);
telemetryData["be"] = random(55,60);
telemetryData["bf"] = random(80,90);
telemetryData["bg"] = random(50,60);
telemetryData["bh"] = random(60,70);

// BMS bools
telemetryData["ca"] = false;
telemetryData["cb"] = false;
telemetryData["cc"] = false;
telemetryData["cd"] = false;
telemetryData["ce"] = false;
telemetryData["cf"] = false;
telemetryData["cg"] = false;
telemetryData["ch"] = false;

// BMS faults
telemetryData["fa"] = false;
telemetryData["fb"] = false;
telemetryData["fc"] = false;
telemetryData["fd"] = false;
telemetryData["fe"] = false;
telemetryData["ff"] = false;
telemetryData["fg"] = false;
telemetryData["fh"] = false;
telemetryData["fi"] = false;
telemetryData["fj"] = false;
telemetryData["fk"] = false;
telemetryData["fl"] = false;
telemetryData["fm"] = false;
telemetryData["fn"] = false;
telemetryData["fo"] = false;
telemetryData["fp"] = false;
telemetryData["fq"] = false;
telemetryData["fr"] = false;
telemetryData["fs"] = false;
telemetryData["ft"] = false;
telemetryData["fu"] = false;

// KLS status
telemetryData["ka"] = random(100,150);
telemetryData["kb"] = (float)random(50,60);
telemetryData["kc"] = (float)random(80,100);
telemetryData["kd"] = (float)random(50,60);
telemetryData["le"] = random(90,100);
telemetryData["kf"] = random(80,90);
telemetryData["kg"] = false;
telemetryData["kf"] = false;

//KLS switch
telemetryData["sa"] = false;
telemetryData["sb"] = false;
telemetryData["sc"] = false;
telemetryData["sd"] = false;
telemetryData["se"] = false;
telemetryData["sf"] = false;
telemetryData["sg"] = false;
telemetryData["sh"] = false;
}

void setup() {
pinMode(rX,INPUT);
pinMode(tX,OUTPUT);
xbee.begin(9600);
}

void loop() {
changeDoc();
serializeMsgPack(telemetryData,xbee);
delay(2000);
}
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Telemetry

To launch application, complete the following:

- pip install -r requirements.txt
- python main.py
- Go to localhost:5000


You can optionally run this in a virtual environment so your installation versions
don't conflict.
Binary file added __pycache__/data.cpython-37.pyc
Binary file not shown.
Binary file added __pycache__/data.cpython-38.pyc
Binary file not shown.
14 changes: 14 additions & 0 deletions artificial_serial.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

touch ttyS10
touch ttyS11


chmod 666 ttyS10
chmod 666 ttyS11


#raw means passing of input output almost unfiltered
#pty generates pseudo terminal to let this happen
#-u indicates unidirectional transfer (one is to write into and the other is to read out of)
socat -u -u pty,raw,echo=0,link=ttyS10 pty,raw,echo=0,link=ttyS11 &
11 changes: 11 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.Python
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
.venv
pip-selfcheck.json
node_modules/
68 changes: 68 additions & 0 deletions data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#handle and store data from xbee here
import random
from datetime import datetime
import msgpack
from openpyxl import load_workbook
import serial
import time




class Info(object):
def __init__(self):
self.workbook = load_workbook(filename="data_label.xlsx")
self.ws = self.workbook.active
self.column = (self.ws['G'])[1:]
self.labels = {}

#identifies array label and adds value to it appropriately
for i in self.column:
if (i.value not in self.labels) and (i.value is not None):
self.labels[i.value] = 1
elif (i.value is not None):
self.labels[i.value] += 1


self.mph = random.randint(10,20);
self.rpm = random.randint(10,20),
self.miles = random.randint(10,20);
self.socTime = str(datetime.now().strftime("%H:%M:%S")),
self.socVal = random.randint(10,200);


def to_json(self):

msgpack_data = {}

for label in self.labels:
num = self.labels[label]
if label == "b" or label == "k":
array_num = []
for i in range(num):
array_num.append(random.randint(10,20))

msgpack_data[label] = array_num
else:
array_bool = []
for i in range(num):
array_bool.append(random.randint(0,1))
msgpack_data[label] = array_bool

return msgpack.packb(msgpack_data, use_bin_type=True)


def output(self, port):
ser = serial.Serial(port, 115200, timeout=1)

while True:
print(type(self.to_json()))
ser.write(self.to_json())
time.sleep(.2)
print("sent")


if __name__ == "__main__":
serial_port = 'ttyS10'
k = Info()
k.output(serial_port)
110 changes: 110 additions & 0 deletions data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{"mph": 13, "rpm": [20], "miles": 15, "socTime": ["18:34:13"], "socVal": 142}
{"mph": 17, "rpm": [14], "miles": 18, "socTime": ["18:34:15"], "socVal": 34}
{"mph": 15, "rpm": [16], "miles": 10, "socTime": ["18:34:24"], "socVal": 67}
{"mph": 18, "rpm": [11], "miles": 19, "socTime": ["18:34:26"], "socVal": 200}
{"mph": 15, "rpm": [19], "miles": 12, "socTime": ["18:34:26"], "socVal": 58}
{"mph": 20, "rpm": [14], "miles": 16, "socTime": ["18:34:28"], "socVal": 43}
{"mph": 20, "rpm": [11], "miles": 16, "socTime": ["18:34:28"], "socVal": 169}
{"mph": 12, "rpm": [15], "miles": 16, "socTime": ["18:34:30"], "socVal": 172}
{"mph": 16, "rpm": [17], "miles": 20, "socTime": ["18:34:31"], "socVal": 89}
{"mph": 18, "rpm": [17], "miles": 13, "socTime": ["18:34:32"], "socVal": 116}
{"mph": 12, "rpm": [18], "miles": 11, "socTime": ["18:34:33"], "socVal": 146}
{"mph": 15, "rpm": [17], "miles": 12, "socTime": ["18:34:34"], "socVal": 30}
{"mph": 10, "rpm": [13], "miles": 10, "socTime": ["18:34:36"], "socVal": 193}
{"mph": 15, "rpm": [20], "miles": 11, "socTime": ["18:34:36"], "socVal": 136}
{"mph": 17, "rpm": [11], "miles": 12, "socTime": ["18:34:38"], "socVal": 53}
{"mph": 11, "rpm": [18], "miles": 17, "socTime": ["18:34:38"], "socVal": 108}
{"mph": 11, "rpm": [14], "miles": 13, "socTime": ["18:34:40"], "socVal": 74}
{"mph": 13, "rpm": [13], "miles": 10, "socTime": ["18:34:40"], "socVal": 76}
{"mph": 13, "rpm": [10], "miles": 11, "socTime": ["18:34:42"], "socVal": 111}
{"mph": 18, "rpm": [15], "miles": 15, "socTime": ["18:34:43"], "socVal": 100}
{"mph": 15, "rpm": [13], "miles": 10, "socTime": ["18:34:44"], "socVal": 170}
{"mph": 19, "rpm": [19], "miles": 12, "socTime": ["18:34:45"], "socVal": 35}
{"mph": 15, "rpm": [14], "miles": 18, "socTime": ["18:34:46"], "socVal": 81}
{"mph": 11, "rpm": [11], "miles": 15, "socTime": ["18:34:48"], "socVal": 132}
{"mph": 19, "rpm": [17], "miles": 18, "socTime": ["18:34:48"], "socVal": 79}
{"mph": 18, "rpm": [16], "miles": 10, "socTime": ["18:34:50"], "socVal": 114}
{"mph": 14, "rpm": [19], "miles": 17, "socTime": ["18:34:50"], "socVal": 101}
{"mph": 14, "rpm": [10], "miles": 10, "socTime": ["18:34:52"], "socVal": 69}
{"mph": 12, "rpm": [13], "miles": 17, "socTime": ["18:34:53"], "socVal": 180}
{"mph": 13, "rpm": [19], "miles": 11, "socTime": ["18:34:54"], "socVal": 114}
{"mph": 11, "rpm": [12], "miles": 17, "socTime": ["18:34:55"], "socVal": 44}
{"mph": 15, "rpm": [19], "miles": 14, "socTime": ["18:34:56"], "socVal": 72}
{"mph": 14, "rpm": [10], "miles": 12, "socTime": ["18:34:57"], "socVal": 111}
{"mph": 13, "rpm": [14], "miles": 15, "socTime": ["18:34:58"], "socVal": 53}
{"mph": 10, "rpm": [11], "miles": 12, "socTime": ["18:35:00"], "socVal": 150}
{"mph": 18, "rpm": [12], "miles": 12, "socTime": ["18:35:00"], "socVal": 12}
{"mph": 20, "rpm": [12], "miles": 19, "socTime": ["18:35:02"], "socVal": 70}
{"mph": 20, "rpm": [12], "miles": 12, "socTime": ["18:35:02"], "socVal": 178}
{"mph": 14, "rpm": [12], "miles": 16, "socTime": ["18:35:04"], "socVal": 111}
{"mph": 14, "rpm": [11], "miles": 18, "socTime": ["18:35:05"], "socVal": 167}
{"mph": 11, "rpm": [17], "miles": 15, "socTime": ["18:35:06"], "socVal": 57}
{"mph": 16, "rpm": [12], "miles": 13, "socTime": ["18:35:07"], "socVal": 142}
{"mph": 19, "rpm": [12], "miles": 13, "socTime": ["18:35:08"], "socVal": 107}
{"mph": 16, "rpm": [11], "miles": 18, "socTime": ["18:35:09"], "socVal": 52}
{"mph": 10, "rpm": [16], "miles": 16, "socTime": ["18:35:10"], "socVal": 172}
{"mph": 17, "rpm": [17], "miles": 12, "socTime": ["18:35:12"], "socVal": 105}
{"mph": 16, "rpm": [14], "miles": 19, "socTime": ["18:35:12"], "socVal": 77}
{"mph": 18, "rpm": [17], "miles": 12, "socTime": ["18:35:14"], "socVal": 65}
{"mph": 11, "rpm": [10], "miles": 13, "socTime": ["18:35:14"], "socVal": 130}
{"mph": 12, "rpm": [12], "miles": 15, "socTime": ["18:35:17"], "socVal": 160}
{"mph": 12, "rpm": [10], "miles": 13, "socTime": ["18:35:17"], "socVal": 78}
{"mph": 10, "rpm": [14], "miles": 19, "socTime": ["18:35:19"], "socVal": 97}
{"mph": 14, "rpm": [17], "miles": 20, "socTime": ["18:35:19"], "socVal": 93}
{"mph": 16, "rpm": [10], "miles": 19, "socTime": ["18:35:21"], "socVal": 122}
{"mph": 18, "rpm": [10], "miles": 15, "socTime": ["18:35:22"], "socVal": 16}
{"mph": 20, "rpm": [15], "miles": 13, "socTime": ["18:35:23"], "socVal": 59}
{"mph": 12, "rpm": [15], "miles": 20, "socTime": ["18:35:24"], "socVal": 112}
{"mph": 11, "rpm": [18], "miles": 17, "socTime": ["18:35:25"], "socVal": 156}
{"mph": 18, "rpm": [12], "miles": 12, "socTime": ["18:35:26"], "socVal": 161}
{"mph": 15, "rpm": [14], "miles": 16, "socTime": ["18:35:27"], "socVal": 166}
{"mph": 19, "rpm": [12], "miles": 15, "socTime": ["18:35:33"], "socVal": 50}
{"mph": 14, "rpm": [18], "miles": 15, "socTime": ["18:35:33"], "socVal": 96}
{"mph": 19, "rpm": [16], "miles": 12, "socTime": ["18:35:35"], "socVal": 150}
{"mph": 17, "rpm": [20], "miles": 19, "socTime": ["18:35:36"], "socVal": 65}
{"mph": 10, "rpm": [15], "miles": 17, "socTime": ["18:35:37"], "socVal": 42}
{"mph": 10, "rpm": [18], "miles": 12, "socTime": ["18:35:38"], "socVal": 138}
{"mph": 10, "rpm": [10], "miles": 14, "socTime": ["18:35:39"], "socVal": 145}
{"mph": 18, "rpm": [12], "miles": 19, "socTime": ["18:35:40"], "socVal": 132}
{"mph": 18, "rpm": [20], "miles": 13, "socTime": ["18:35:41"], "socVal": 13}
{"mph": 15, "rpm": [10], "miles": 10, "socTime": ["18:35:42"], "socVal": 74}
{"mph": 15, "rpm": [12], "miles": 19, "socTime": ["18:35:43"], "socVal": 37}
{"mph": 16, "rpm": [10], "miles": 14, "socTime": ["18:35:44"], "socVal": 63}
{"mph": 12, "rpm": [14], "miles": 19, "socTime": ["18:35:46"], "socVal": 176}
{"mph": 18, "rpm": [11], "miles": 18, "socTime": ["18:35:46"], "socVal": 116}
{"mph": 18, "rpm": [18], "miles": 16, "socTime": ["18:35:48"], "socVal": 184}
{"mph": 14, "rpm": [16], "miles": 14, "socTime": ["18:35:49"], "socVal": 57}
{"mph": 15, "rpm": [16], "miles": 19, "socTime": ["18:35:50"], "socVal": 189}
{"mph": 14, "rpm": [19], "miles": 11, "socTime": ["18:35:51"], "socVal": 109}
{"mph": 15, "rpm": [19], "miles": 12, "socTime": ["18:35:53"], "socVal": 77}
{"mph": 14, "rpm": [16], "miles": 19, "socTime": ["18:35:53"], "socVal": 66}
{"mph": 14, "rpm": [20], "miles": 11, "socTime": ["18:35:55"], "socVal": 157}
{"mph": 16, "rpm": [11], "miles": 10, "socTime": ["18:35:55"], "socVal": 124}
{"mph": 17, "rpm": [17], "miles": 10, "socTime": ["18:35:57"], "socVal": 25}
{"mph": 11, "rpm": [11], "miles": 15, "socTime": ["18:35:57"], "socVal": 195}
{"mph": 13, "rpm": [18], "miles": 12, "socTime": ["18:35:59"], "socVal": 13}
{"mph": 15, "rpm": [20], "miles": 15, "socTime": ["18:36:00"], "socVal": 156}
{"mph": 14, "rpm": [14], "miles": 18, "socTime": ["18:36:01"], "socVal": 98}
{"mph": 16, "rpm": [12], "miles": 16, "socTime": ["18:36:02"], "socVal": 164}
{"mph": 11, "rpm": [18], "miles": 17, "socTime": ["18:36:03"], "socVal": 196}
{"mph": 20, "rpm": [14], "miles": 14, "socTime": ["18:36:04"], "socVal": 99}
{"mph": 16, "rpm": [20], "miles": 13, "socTime": ["18:36:05"], "socVal": 133}
{"mph": 17, "rpm": [14], "miles": 19, "socTime": ["18:36:07"], "socVal": 175}
{"mph": 18, "rpm": [14], "miles": 17, "socTime": ["18:36:07"], "socVal": 35}
{"mph": 18, "rpm": [17], "miles": 15, "socTime": ["18:36:09"], "socVal": 120}
{"mph": 12, "rpm": [19], "miles": 19, "socTime": ["18:36:09"], "socVal": 72}
{"mph": 12, "rpm": [10], "miles": 18, "socTime": ["18:36:14"], "socVal": 196}
{"mph": 14, "rpm": [14], "miles": 16, "socTime": ["18:36:16"], "socVal": 25}
{"mph": 12, "rpm": [18], "miles": 10, "socTime": ["18:36:18"], "socVal": 84}
{"mph": 10, "rpm": [17], "miles": 12, "socTime": ["18:36:20"], "socVal": 101}
{"mph": 20, "rpm": [10], "miles": 14, "socTime": ["18:36:22"], "socVal": 181}
{"mph": 10, "rpm": [20], "miles": 20, "socTime": ["18:36:25"], "socVal": 80}
{"mph": 16, "rpm": [13], "miles": 19, "socTime": ["18:36:27"], "socVal": 145}
{"mph": 10, "rpm": [12], "miles": 19, "socTime": ["18:36:29"], "socVal": 173}
{"mph": 19, "rpm": [17], "miles": 15, "socTime": ["18:36:31"], "socVal": 131}
{"mph": 15, "rpm": [12], "miles": 12, "socTime": ["18:36:33"], "socVal": 14}
{"mph": 13, "rpm": [16], "miles": 18, "socTime": ["18:36:35"], "socVal": 135}
{"mph": 20, "rpm": [15], "miles": 16, "socTime": ["18:36:38"], "socVal": 155}
{"mph": 16, "rpm": [16], "miles": 20, "socTime": ["18:36:40"], "socVal": 113}
{"mph": 15, "rpm": [12], "miles": 12, "socTime": ["18:36:42"], "socVal": 77}
{"mph": 17, "rpm": [17], "miles": 18, "socTime": ["18:36:44"], "socVal": 14}
Binary file added data_label.xlsx
Binary file not shown.
Loading