The Teslonda Dash consists of a two RaspberryPi 3s running Raspberian Lite, networked to each other via Ethernet.
It runs a NodeJS app that listens and parses CAN messages from an HSR controller. Sends the data via websocket to to the Teslonda Front-end.
It also servers the front up via NodeJS Express.
- Compile Teslonda Front-end
- Copy to the
public/dist
directory on the server of the Raspberry Pi3 - Run the server!
This was a pet project that was made in rapid prototype fashion due to massive time constraints; there are no tests, there are plenty of style guide violations as this was my first NodeJs project. This was uploaded without curation so I apologize for the possible curse words, bugs and bad form you might come across. There are no hard-tabs though, so there is that.
This comes preloaded with a version of the Teslonda Dash ready to rumble.
This launches a webserver that will serve up the Front-end dash content as well as launch a Node app that will listen to CAN from a HSR (look up Jason Hughes HSR) Controller.
It's imporant to group data up in "frame" packets; deliver relevant data every 16ms (equilivant to 60fps) as to not drown the front-end in data; the Raspberry Pi 3 is pretty dang capable but when a busy clunky frontend like a chromium web-app receives socket data, a lot happens each time data comes in, and will quickly bog things down if it isn't regulated.
- on your raspberry pi
- copy all contents to
can-server
- Prepare Dev enviroment on RPI: run
./RPI_system/prepare_dev.sh
- Or prepare production environment: run
./RPI_system/prepare_production.sh
- The front-end web content (Teslonda Front-end) is stored in
public/dist
. npm run vcan_server
- virtual-CAN and test servernpm run can_server
- CAN server- Teslonda Front-end served on
localhost:3333
- Websocket Server listening to
localhost:4000
npm run can_server
- to get main web server and can server up and running- Get the Pi's IP
- On your local pc, navigate to
[pi's ip]:3333
- Modify App code in Comm service to connect to
[pi's ip]:4000
- Enable SPI either through
raspi-config
or adddtparam=spi=on
to/boot/config.txt
- put the following in /boot/config.txt
#CAN bus controllers
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=spi-bcm2835-overlay
- sudo nano /etc/network/interfaces
- Paste this
auto can0
iface can0 inet manual
pre-up /sbin/ip link set can0 type can bitrate 500000 triple-sampling on
up /sbin/ifconfig can0 up
down /sbin/ifconfig can0 down
https://gist.github.com/Mathews2115/3be0b1173be222e73ba4d8181558d409