Quantcast
Channel: SparkFun Tutorials
Viewing all articles
Browse latest Browse all 1123

BadgerHack: Sensor Add-On Kit

$
0
0

BadgerHack: Sensor Add-On Kit a learn.sparkfun.com tutorial

Available online at: http://sfe.io/t476

Introduction

The BadgerStick that you received by visiting a SparkFun booth at one of the various events we’ve attended can be hacked to perform a wide variety of tasks. The BadgerStick is a fully capable microcontroller that can sense the environment around it.

BadgerHack

This tutorial will guide you through turning your BadgerStick into an environment sensing station. We’ll do so by adding a temperature sensor and a soil moisture sensor.

SparkFun BadgerStick and Sensor add-on kit with plant

Plant not included

NOTE: The BadgerStick and RedStick are two different products. The BadgerStick (aka BadgerHack) originated as an event-only platform to aid SparkFun in teaching soldering and programming at events like Maker local Faires and SXSW. The RedStick evolved from that concept and is the retail version of the BadgerStick, available for sale on SparkFun.com. All of the BadgerStick tutorials and expansion kits are compatible with both the BadgerStick and the RedStick, unless otherwise stated.

Required Materials

On top of your Badgerstick/Redstick and LED array display you will need a few more parts for this project:


Heads up! At the time of this writing, the LED Matrix is only available at events where SparkFun is hosting workshops. For those who wish to follow along with their ReStick, a compatible version of the LED matrix will be available for sale on the SparkFun website in the near future.

Suggested Reading

Before starting this tutorial, we highly recommend you work through the main BadgerHack guide first.

BadgerHack

September 23, 2015

This tutorial shows users how to solder their SparkFun interactive badges as well as put them to use in other projects.

Additionally, if you are new to soldering or electronics, we recommend you check out the following:

When you are ready to start hacking your badge, we definitely recommend reading:

Hardware Hook-up

There is a little bit of soldering, so if you need a quick refresher on that I suggest taking a look at our soldering tutorial.

To begin, snap off 15 pins from the break-away headers, and solder them to the through-holes on the side opposite the LED array of the BadgerStick.

BadgerStick with headers

You can place the headers in the breadboard to help keep them in place as you solder.

Soldering BadgerStick with breadboard

The rest of the setup will be using the breadboard and the jumper wires.

Start by sticking the headers you just soldered to your stick at a corner of your breadboard.

Now we will connect the sensors as follows:

Component PinBadger/Redstick Pin
Soil Moisture Sensor VCCVCC
Soil Moisture Sensor GNDGND
Soil Moisture Sensor SIGA0
Temperature Sensor leftGND
Temperature Sensor middleA4
Temperature Sensor rightVCC

* Pins not listed are not used.


Here is a picture layout of how to connect everything up

Fritzing Diagram of badgerstick badgerhack add-on kit hookup

Fritzing diagram of a RedStick hookup (GND and VCC slightly different on a BadgerStick).

SparkFun BadgerStick and Sensor Add-on kit layout

IMPORTANT: You will need to power your Badgerstick/Redstick through its USB port or a USB extension cable, so that the analog sensors are getting a known voltage. You can cut the battery pack off, you can leave the battery pack attached but turned off, or you can power it through the battery pack. Just know that your temp reading will become less accurate the more your battery drains.

With everything hooked up, it’s time to upload some code.

Code

Analog sensors work by providing a voltage output that is proportional to the what they are measuring. This means with something like analog temp sensor we are using, the output voltage can be converted to temperature easily using the scale factor of 10 mV/°C. However, a little bit of math is required depending on what the input voltage is, so that will change based on if you are using the Badgerstick at 3.3V or the Redstick at 5V. (But don’t worry, this has already been done for you in the code.)

The soil moisture sensor works the same way, but we are leaving the data as is, since converting it to something usable like kg of water per kg or soil would be very difficult without knowing what kind of soil you have and how it reacts to electricity.

Plug the USB side of your BadgerStick into your computer. Make sure “BadgerStick” and the associated COM port are selected in the window below. Click “Run on Arduino.”

If you have the Redstick Make sure “Arduino Uno” and the associated COM port are selected in the window below. Click “Run on Arduino.” Also if you are using a Redstick, you will need to go into the code and change one variable at the end to have the correct temp output (instructions in the code).

Resources and Going Further

With that, you should have an environment sensing station over which you have full control.

If you make something cool with your Badger, share it with #BadgerHack, or create a tutorial on hackster.io.

Like sensors? Here are a few more sensors that are pretty cool:

FLiR Dev Kit

KIT-13233
$259.95
16
9 Degrees of Freedom - Razor IMU

SEN-10736
$74.95
7
SparkFun Load Cell Amplifier - HX711

SEN-13230
$9.95
13
SparkFun 9 Degrees of Freedom IMU Breakout - LSM9DS1

SEN-13284
$24.95
2

Resources

Other BadgerHack Projects

Check out some of the other things you can make with the Badger:

New!

BadgerHack: Gaming Add-On Kit

February 16, 2016

Make a Breakout clone with the BadgerHack Gaming Add-On Kit.


learn.sparkfun.com |CC BY-SA 3.0 | SparkFun Electronics | Niwot, Colorado


Viewing all articles
Browse latest Browse all 1123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>