Skip to content

harding/sensor21

 
 

Repository files navigation

How to run and publish: sensor21

Prerequisites

You will need:

  • A 21 Bitcoin Computer, or a DIY Bitcoin Computer
  • An Adafruit MPL3115A2 Breakout Board
  • A set of female to female jumper wires

For a full walkthrough, see the sensor21 tutorial here.

Hardware Setup

Connect your 21BC / DIY 21BC to the MPL3115A2 breakout board. See the connection diagrams on the tutorial page for more information.

Software Setup

Step 1: Install/update 21

Get the latest version of the 21 software. If you don't have 21 installed yet, run curl https://21.co | sh. Then, join the 21 marketplace network.

# Install 21 if required
curl https://21.co | sh

# Run 21 update
21 update

# Join the `21market` network
21 join

Step 2: Clone the repository

Clone the sensor21 repository, and run the setup script. You will be asked for user input multiple times.

cd ~/

# Install git to clone the Sensor21 code
sudo apt-get install git

# git clone the code
git clone https://github.com/21dotco/sensor21.git

# run the setup script
cd sensor21
source setup.sh

Step 3: Start your server and publish your endpoint

Start the server with the following:

python3 sensor21-server.py -d

After the server is running, pubish your endpoint with the 21 publish command. Replace the name and email fields with your information.

21 publish submit manifest.yaml -p 'name="Joe Smith" email="joe@example.com" price="5" host="AUTO" port="6002"'

Step 4: Verify you are part of the aggregator pool

After a few minutes, you should be able to use 21 publish list to see the endpoint you just put up:

21 publish list

You can also use the verify endpoint on the sensor21 aggregator. Load your zerotier ip address, and then query the enpoint to verify you are part of the pool.

# grab your ZeroTier IP address and save it to shell variable ZT_IP
ZT_IP=$(ifconfig | grep -A2 zt | grep inet | sed 's|[^0-9. ]||g' | sed 's|[^ \t]*||' | awk 'NR==1{print $1}')

# verify your endpoint is part of the pool
curl https://mkt.21.co/21dotco/sensor21_aggregator/sensor21/verify?zt_ip=$ZT_IP

Step 5: View transactions with 21 log

After your server has been online for ~30 minutes, you can start to see transaction logs from the aggregator in your 21 log. You can see your incomes from sensor21 by running 21 log.

21 log

Trobuleshooting

See the detail on troubleshooting your application here.

If you have further support requests, please join our public slack channel #iot here.

About

Earn bitcoin by collecting environmental data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 66.4%
  • Shell 33.6%