GithubHelp home page GithubHelp logo

plastic-scanner / db2.x-firmware Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 3.0 167 KB

Firmware for the DB2.X (development board) of the Plastic Scanner project

License: GNU General Public License v3.0

C++ 95.81% C 4.19%

db2.x-firmware's Introduction

DB 2.x - Firmware

This is the firmware repository for the DB2.X (development board) of the Plastic Scanner project. More technical information is in the docs and general information about project on our website.

Requirements

Firmware runs on DB2.x (tested on DB2.1), powered by Arduino. Requires PlatformIO, a cross-platform embedded development toolset. See installation instructions here it can be as easy as one-click-plugin-installation (PlatformIO IDE).

In order to build and upload the firmware to DB2.x, connect the board to computer and find the Build and Upload buttons in the PlatformIO IDE OR use the following commands:

$ pio run -t upload 		# build and upload fw image

The compiled firmware image is placed in .pio/build/<board>/firmware.hex.
Compilation options can be tweaked in platformio.ini file (see build options).

Usage

Connect your DB2.x to your laptop, build and flash the firmware and open the serial console with $ pio device monitor or your favourite app (e.g Putty, screen, minicom, picocom...). Enable local echo in order to see commands you're typing by adding --echo to command above, or pressing CTRL+T followed by CTRL+E while running it.

User can send commands like this:

> scan

which outputs a full scan, 8 values, one for each LED.

See app/main.cpp at setup() function which commands are defined or type help to list all commands.

Development

Feedback on architecture and implementation is welcome. Firmware currently controls an Arduino, which "talks" to an ADC chip and a LED driver, communicating via the serial interface. In directory app are the main sources, test is for unit tests (which needs much more love and actual tests), drivers contains custom drivers for componments on board.

NOTE about drivers: at the moment we're using a third party library for the ADC, listed in platformio.ini at [lib_deps], with sources located in .pio/libdeps/uno/. However, we hope to soon implement a custom, simpler driver for it which will be located in drivers/ads1256.

db2.x-firmware's People

Contributors

jurc192 avatar jerzeek avatar

Stargazers

Alex avatar Todd Owen avatar Alexey Vazhnov avatar

Watchers

 avatar

db2.x-firmware's Issues

Make line-ending configurable

Now we can handle receiving of all possible line-endings (LF, CR, CRLF), but outputting stuff is still only the arduino-default-way (CRLF) and not configurable. Turn this into a configurable, "deterministic" setting.

Add support for AS7341 in firmware

Someone proposed adding a color sensor to get more information about the plastic sample. we settled on the AS7341 (thanks Loki!), for testing we bought the Adafruit breakout board. The DB2.1 already has a QWIIC connector so assembly is simple, we just need to implement it in the firmware! This can be as simple as adding the example code to the platformIO environment

Write a simple(r) driver for the ADS1256

I believe that a small, custom driver for the adc would make the code smaller, simpler and more to the point for our use-case.
We could be consistent with the style - not doing anything in constructor, simplify and shorten function names, combine waitDRDY + scan into one function call, etc.

Feedback on overall FW architecture, implementation, style

Feedback from experienced firmware engineers would be amazing! What is well done, what can be improved? What conventions am I breaking or unaware of? How to make code more human-readable and simple? How can I document, explain it better?

Unit tests

Currently there's almost no unit tests in place. What should we test? How?
One thing I can think of - "bombing" the cli (command line interface) with commands and seeing when and why it freezes. Another thing could be measuring adc values and checking if they are in a reasonable range?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.