Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Since there is a flutter app that analyzes the CAN data and provides us with metrics on the vehicle, we need to be able to send WebSocket messages to the flutter app which can be set up through Node-Red. However, we also need to format these WebSocket messages as a JSON , similar to what is shown below on MongoDB Atlas.

...

as shown below.

CAN Messages

Property

Sample Value

Datetime

2020-01-20 03:14:07

Name

MOTOR_CONTROLLER_VC

Sender

MOTOR_CONTROLLER

Data

{

'mc_voltage1':1234,

‘mc_current1’:1

)

GPS Data

Property

Value

Decoded

Datetime

030620 044747.0

June 3, 2020 4:47:47.0

Latitude

3722.117666

37° 22.117666'

Latitude Direction

N

North

Longitude

12200.011971

122° 00.011971'

Longitude Direction

W

West

Altitude (meters)

11.6

11.6

Speed (knots = 1.852 km/h)

0.0

0.0

Course (degrees)

0.0

0.0

The aggregate_can_data.py script allows us to grab data from the CAN bus, decode the message with our DBC file, write to a CSV, send to FRED with MQTT, and send to MongoDBto DynamoDB.

The GPS.py script allows us to grab GPS data from the vehicle.

Storing Data on the Raspberry Pi

In terms of storing data locally on the Raspberry Pi, the Python script aggregate_can_data.py can directly output the data to a CSV file locally on the Raspberry Pi. These files can be manually moved to Google Drive if necessary.

...

Format of CAN Messages and GPS Data in DynamoDB

Property

Value

Decoded

Latitude

3722.117666,N

37° 22.117666' N

Longitude

12200.011971,W

122° 00.011971' W

UTC Date

030620

June 3, 2020

UTC Time

044747.0

4:47:47.0

Altitude (meters)

11.6

11.6

Speed (knots = 1.852 km/h)

0.0

0.0

Course (degrees)

0.0

0.0