Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
94 lines (71 sloc) 3.2 KB

Ammolytics: Open Trickler Controller

This portion of the Open Trickler is used to control the scale and trickler motor. It's designed to be run on a Raspberry Pi Zero W, but any similar system which supports Bluetooth will likely work as well.

Instructions

Download and install Raspbian Lite. I recommend enabling SSH and Wifi

Once booted, connect via SSH

ssh pi@raspberrypi@local

Initial configuration

sudo raspi-config

From the menu:

  • Change Network > Hostname from raspberrypi to opentrickler
  • Run Advanced Options > Expand Filesystem to provide more space on the SD card

After making this changes, select Finish. It will ask if you want to reboot, select Yes. At this point, you will be disconnected. It'll take about 60 seconds for the system to come back online with a new hostname.

Reconnect with SSH

ssh pi@opentrickler.local

Install system dependencies

sudo apt-get update
sudo apt-get install -yqq git bluetooth bluez libbluetooth-dev libudev-dev

Get a copy of the Open Trickler code

git clone https://github.com/ammolytics/projects.git

Run the Open Trickler setup script

Note: The setup.sh script is intended for the Pi Zero W. If you're using a different board, you'll need to change the version of NodeJS from armv6l to match the chipset of your system.

cd projects/trickler/peripheral
./bin/setup.sh

Start the Open Trickler

node index.js /dev/ttyUSB0

To run it as a service

pm2 start ecosystem.config.js
pm2 startup systemd

Run the command that it returns, which will look something like sudo env PATH=$PATH:/usr/local/.../node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi

pm2 save
sudo systemctl start pm2-pi

For Developers

Note: Most of the development was done on a Mac, and the setup scripts reflect that.

First, clone this repository

Next, run the setup script. This will create a virtual environment with the same version of NodeJS that's used on the Pi, and install other dependencies.

./bin/setup.sh

That's it! If you don't have an A&D scale, I created a very simple mock to fill in some of those gaps. You can a server that uses it with the following command.

./bin/mock.sh

References

You can’t perform that action at this time.