Skip to content

Controls actuators and sensors for our prototype: The Outpost. Canadian Space Agency's Deep Space Food Challenge semifinalists.

Notifications You must be signed in to change notification settings

Canacompost-Systems-Inc/microcontroller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Canacompost Microcontroller

Introduction

This repository contains the microcontroller code which will receive commands from the Integrated Computer (Jetson Nano) and then execute them by turning actuators or polling the sensors for data.

Acronyms

  • IC = Integrated Computer
  • MCU = MicroController Unit

Resources

Quickstart Guide

PlatformIO Installation

Our project uses PlatformIO to build and deploy code to the Arduino board. The easiest (and suggested) way to get started with PlatformIO is to install the VSCode extension for it. If you wish to use a different editor than VSCode you could install the PlatformIO core CLI separately.

Deployment

There are two main ways to deploy code onto the Arduino: locally via serial port, or remotely via the IC.

To deploy locally, connect your computer to the Arduino via serial port, then click the PlatformIO upload button on the lower toolbar as seen in the image below. Note you can also build without uploading using the build button. See this documentation for the offical quickstart guide.

image

To deploy remotely SSH into the Jetson Nano and start the pio agent:

pio agent remote start

Then From your local machine, run the following if using the Mega 2560, which will compile your code locally and upload it to the remote device:

pio remote run --environment megaatmega2560 --target upload

You can also use the PlatformIO Tab by clicking the Remote Development / Remote Upload button as selected below

image

Testing

Currently there are no automated tests for the MCU. Instead a python script is provided in test/shell.py which allows us to manually send commands to the MCU to test its behavior. Before running this script ensure that the MCU is connected via serial port to your computer (if working locally) or the IC (if working remotely).

Next you will need to make sure the serial_port variable in shell.py is correctly set. To find the serial port that the MCU is connected to issue the following command (MacOS and Linux):

ls /dev/tty*

This command should return a list of paths. The path corresponding to the MCU should have one of these prefixes: /dev/ttyUSB* or /dev/ttyACM*. Once you have found the correct serial port, update the serial_port variable. Then you can run the testing script (note you may need to use pip to install the serial library):

python ./shell.py

Finally, to send commands to the MCU enter one of the following (corresponding to endpoints defined in the API Docs).

Get Snapshot:

get all 

Get Device:

get <DID> 

Set Device:

set <DID> <New_Value>

Debugging

If any error is encountered during operation the MCU will continuously print the error message string. Read from the serial port using the serial monitor to fetch these error messages.

About

Controls actuators and sensors for our prototype: The Outpost. Canadian Space Agency's Deep Space Food Challenge semifinalists.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •