Starter Kit Instructable

From P2P Food Lab
Revision as of 08:37, 10 March 2015 by Hanappe (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The Starter Kit is a common platform to help people grow vegetables in urban and peri-urban areas. The platform consists of a small greenhouse (1.2m x 1.2m), a sensor box with wireless communication, an online community web site, and a collecion of seeds.

The sensor box inside the greenhouse measures the temperature and humidity (inside and outside), and the sunlight. A webcam takes pictures of the plants growing inside the greenhouse. The designs of greenhouse and the sensor box are open and can be easily build by DIY’ers. We aimed to make the equipment as low-cost and as adaptable as possible in order to reach a wide audience. For the sensor box, we use an Arduino for the measurements and a Raspberry Pi for the wireless communication and webcam.

On the community web site, participants can interact with each other to ask questions, provide tips, or simply annotate their activities in their online notebook. The gardeners can visualise each other’s sensor data and notebooks. Submitting new notes is simple. Hashtags can be used to categorise notes and images can be attached to each post. Several hashtags have a predefined semantics and transmit the posts to specific message channels such as, for example, the ‘questions & answers’ or ‘tips’ channel. Our aim is to use this common platform -greenhouse, sensors, web site – as a tool for citizen science projects in the field of vegetable gardening.

The gardening enthusiasts can use the Starter Kit to coordinate scientific experiments and study the effects of plant varieties, soil or meteorological conditions on the productivity. For example, by using the same seeds in different locations, or by associating different species together, we can obtain data about the efficiencies of different strategies. Quantitative data can be obtained by analysing the images, the sensor data, and the notes submitted by the participants.


Step 0: Select your seeds

Step 1: Design and Build your greenhouse

1.0 What you need

Bills of Materials

The structure
Type References & Dimensions Quantity Unit price Total price
Wooden battens L=2m40 or 2m50, section ~2cmx2cm 11 4.5 € 50 €
Screws 4.5mm x 60mm, for outside use 30 0.20 € 6 €
Geotextile 3 m2 (bottom included),

1.5 m2 (sides only)

2 €/m2 10 €

(?, often sold in larger quantities)

Palette wood 3 palettes 0 0
TOTAL 56€


The cover
Type References & Dimensions Quantity Unit price Total price
Plastic film transparent, U.V. resistant, 200 microns

(example)

8 m2 2.20 €/m2 18 €
Hook and loop fastener (Velcro) 20mm wide 15 m 35 € / 25m 21 €
Sewing Thread ? ? ? ?
TOTAL 40€

Nota

Wooden battens

To optimise the number of battens that you need, and to minimise the amount of wasted wood, the following dimensions are a good compromise (all dimensions are measured inside the greenhouse, see here): For 2m40 battens: WxDxH = 1.10m x 1.10m x 1.34m. For 2m50 battens: WxDxH = 1.16m x 1.16m x 1.40m. In both cases, you will need 11 battens.

Geotextile

Inside the box, you can either use geotextile or plastic sheets for "drainage" (google). In french, search for "feutre géotextile" and "drainage vertical alvéolé" (example). If the greenhouse will be put on a terrace, a hard surface, or polluted ground, you have to cover the bottom of the box with geotextile that let's the water through. If the greenhouse is put on soil, you only have to protect the sides of the box.

Plastic cover

For the cover, we use transparent, U.V. resistant, 200 microns plastic film. It's not the most beautiful solution but it's the cheapest one. Alternative solutions (glass, transparent polycarbonate, or polymethyl methacrylate (PMMA, or Plexiglass)) are much more expensive.

Fasteners

So far, we've used hook and loop fasteners (velcro) to fix the greenhouse cover. Alternative options are snap fasteners and eyelets (Fr.: oeillet metal) but we haven't tried them, yet.

Equipment

The structure
  • Paper tape, useful also as an alternative to the clamps
  • Pencil and meter
  • Nail pincers or nail pullers (to remove nails from palette wood)


The cover

1.1 Design your greenhouse

The final result looks something like this

The structure of the greenhouse

The first thing you need to do is to calculate the length of the different elements of your greenhouse, and firstly, the wooden barrens.

The wooden barrens

You need the following elements to build the structure:


List of wooden bars


General Overview


((Insert table with general dimensions))

Use the calculator to adapt the general dimension of the blueprint to suit your needs.

1.2 Build the greenhouse structure

1.2.1 Cut the wooden battens

Mark the different elements prior to cut the wood. Double check before cutting, and try to limit wood waste.


Mark the wooden battens


Use a hand saw or a rotating saw to cut the battens to length. A mitre box is better to make clean cuts when using a hand saw.


Mitre box


Use sandpaper to smooth the edges.

1.2.2 Assemble the battens

Start by assembling each sides and the roof separately.


One side at a time


Use clamps to keep the bars in place while drilling.


A clamp in action


Drill holes before screwing the bars


Drilling before screwing


Try to drill "in parallel" to avoid mistakes and measuring dimensions only once.


Drilling in parallel


Use a right angle when fixing bars at 90°. Tape bars to keep bars in place after angle is mesured.


Right angle in action


Tape on bars


To ease the operation, work on a flat zone.


The "flat" work zone


To assemble the sides together, use some help from someone else.


The final assembly, a team effort


With a little help from a wall

1.2.3 Cut the palette wood

Option 1: Disassemble the palette by using a crowbar, a hammer and/or a nail puller => best solution to limit wood waste

Option 2: Cut the palette woods between the legs => best solution if you're lazy

Option 1: Disassemble
Option 2: Cut


Cut as many panels as needed as width may vary depending on the palette. Length should be around 30 cm, check the up-to-date blueprint above.


Side panels

1.2.4 Assemble the side panels

Put the side panels in place and use tape to keep them in place. Wait after putting the geotextile to drill and screw.


Keep side panels in place with tape

1.2.5 Add the geotextile

Cut the geotextile to dimensions (side-only or with bottom depending of your configuration) and place it inside the side panels. Keep it in place with tape to find the right position.

Cut geotextile


Place geotextile


Take extra-caution with the angles


Angle


Fill greenhouse with soil. Fix geotextile and/or wood panels if needed.


The soil keeps panels in place

1.3 Make the greenhouse cover

1.3.1 Draw the shape on the plastic

Use a long ruler to draw the shape on the cover plastic. Respect the dimensions as we don't want any extra material on the greenhouse.

Draw shape on plastic

1.3.2 Cut the plastic

Cut the plastic with scissors.

1.3.3 Sew the velcro

Use a sewing thread not too thick, as it will break in the sewing machine, but strong enough.


Sewing machine

1.3.4 Fix the velcro on the greenhouse

Use staples to fix the velcro.

The velcro


The velcro

1.4 Add the roof

Add the roof after putting the cover on the sides of the greenhouse


The roof


Add the velcro on the roof and cut the cover to make a hinge.

Step 2: Build the sensorbox

2.0 What you need

You have several options depending of your needs and budget. We have divided the materials in different groups: the Basic Board for all the stuff needed to build the aggregator node, then you can choose among different sensors (temperature, air humidity, soil humidity ...) and configuration (onboard, standalone).

Bills of Materials

Aggregator node

The basic board
Type References & Dimensions Quantity Unit price Total price
Arduino Pro Mini 328 3.3V 8MHz Arduino Pro Mini 328 3.3V 8mHz 1 12€ 12€
FTDI Basic Breakout 3.3V Sparkfun Basic Breakout 3.3V 1 11€ 11€
Raspberry Pi Model B Raspberry Pi 1 28€ 28€
Raspian SD Card RASPBERRY-PI / PROG-4GB-SDCARD 1 10.5€ 10.5€
USB cable, M/F, 25cm [1] 1 1.09€ 1.09€
USB Connector USB2066-05-RBHM-15-STB-00-00-A / To connect the solar panel 1 1.05€ 1.05€
26-way female board-to-board connector SAMTEC - BCS-113-L-D-TE 1 5.9€ 5.9€
1-row 12-way header pins Header pins 2.54MM 36WAY / To connect the Arduino to the main board 2 1.27€ 2.54€
1-row 6-ways header pins (bended) Header pins 2.54MM 36WAY / used to connect the FDTI to the Arduino 1 1.51€ 1.51€
JST-3 header B3B-PH-K-S / Used to connect the sensors to the main board 4 0.15€ 0.60€
MOSFET STU95N2LH5 1 0.72€ 0.72€
Main PCB ND 1 ND ND
Resistance 100 MOhms [2] 2 1€ 2€
TOTAL 76.91€ + PCB
Networking options
Networking
Type References & Dimensions Quantity Unit price Total price
Option 1: USB WiFi Dongle D-LINK DWA-127 1 20€ 20€
Option 2: USB GSM Dongle with SIM Card Huawei E176 1 31€ 31€
Option 3: Ethernet On board 1 0 0
Options to power the aggretator node
Power
Type References & Dimensions Quantity Unit price Total price
Solar panel Opteka Solar Charger BP-SC4000 (4000 mAh, 1.0A, 11.4 x 8.4 x 1.4 cm) 1 28€ 28€
AC/DC adaptor 5V 1A AC/DC adaptor 1 4.43€ 4.43€

Temperature and Humidity Sensors

Option 2: Remote temperature and humidity sensor
Type References & Dimensions Quantity Unit price Total price
Humidity and Temperature Sensor RHT03 / DHT-22 1 14 14
JST-3 header B3B-PH-K-S / Used to connect the sensors to the main board 1 0.15€ 0.15€
4k7 resistance RESISTANCE 0805 4K7 1 0.041€ 0.041€
JST-3 header plug JST-3 header plug 1 0.05€ 0.05€
3-way wire
TOTAL 14.15€


Option 3: High quality temperature and humidity sensor (options for two sensors)
Type References & Dimensions Quantity Unit price Total price
Sensor SHT15 1 >40 >40
4-way connector BG300-04-A-L-A 1 1.00 1.00
Pins Header pins 2.54MM 1 1.51 1.51
Telephone wire
Sensor PCB ND ND ND ND
TOTAL xxx

Other sensors

Light sensor
Type References & Dimensions Quantity Unit price Total price
Light sensor OSRAM SFH 203 P 1 1.07 1.07
390 Ohm Resistance 390 Ohm 0805 type 1 0.017 0.017
TOTAL xxx


Pump & Pump connection
Type References & Dimensions Quantity Unit price Total price
Pump Reference needed  ?  ?  ?
Water flexible Reference needed  ?  ?  ?
Screw PCB Terminal Multicomp MC000018 2 0.70 1.40
MOSFET STU95N2LH5 1 0.72 0.72
Header pins 3-way Header pins 2.54MM 1 1.51 1.51
JST-2 header B2B-PH-K-S 1 0.12€ 0.12€
Jumper 2-way jumper 1 0.31 0.31
Pump PCB ND ND ND ND
TOTAL xxx


Soil humidity sensor
Type References & Dimensions Quantity Unit price Total price
Screw PCB Terminal Multicomp MC000018 1 0.70 0.70
555 timer chip LMC555CM 1 1.13 1.13
390 Ohm Resistance 390 Ohm 0805 type 1 0.017 0.017
150 kOhm Resistance 150 kOhm 0805 type 1 0.009 0.009
2.2 uF capacitors 2.2uF capacitor type 0805 2 0.37 0.74
TOTAL xxx


Camera
Type References & Dimensions Quantity Unit price Total price
Webcam Logitech C310 1 35 35

Protection box

Option 1: Plastic box
Description Reference Quantity Unit cost (euro) Total cost (euro)
Box to protect external humidity sensors ND ND ND ND
Plastic box solution
Option 2: Wood box
Description Reference Quantity Unit cost (euro) Total cost (euro)
Plywood 25cm x 65 cm, 5mm ND ND ND ND
Wood box solution

Other materials (to be reviewed by Peter)

Description Reference Quantity Unit cost (euro) Total cost (euro)
The basic board
USB Mini cable ND ND ND ND
Ethernet cross cable ND ND ND ND
3 x 1-way wire, LIY, 15cm ND ND ND ND
3-way protected wire, 200cm ND ND ND ND
2 x 1-way wire, LIY, 5cm ND ND ND ND
AAA batteries and Battery holder, 3xAAA (optional ?) ND ND ND ND
Male header, 6-way ND ND ND ND
JST-2 plug ND ND ND ND
JST-2 header ND ND ND ND
JST-3 plug ND ND ND ND
JST-3 header ND ND ND ND
JST-4 plug ND ND ND ND
JST-4 header ND ND ND ND
Resistance for lightsensor, 12 kOhm (??? 390 Ohm in the bill of material) ND ND ND ND
Transistors for lightsensor (??? Not in the bill of material) ND ND ND ND
FRAM ND ND ND ND
Jumper ND ND ND ND
Male headers (breakable) 2x12, 1x2, 1x3 ND ND ND ND
Terminal block, 2 way, 3.81mm ND ND ND ND
Screw & bolts ND ND ND ND
Washers ND ND ND ND
Wood screws to fix lightsensor ND ND ND ND
Spacers & screws ND ND ND ND

Nota

Sensorbox V3 - Materials Nota

Equipment

The structure

The PCB

New version (June 2014)

Main PCB Front
Main PCB Back

Schematics file

(To be added)

Arduino port used by sensors

  • Port 2: RHT03 (external sensor - thrx in config.json)
  • Port 4: RHT03 (internal sensor - thr in config.json)
  • Port A2: Luminosity
  • Port 9: Raspberry Pi
  • Port A3: Battery USB
  • Port 8: Pump
Internal and external thermal temperature connections on the board

2.1 Solder components on main PCB

Solder USB plug

It's used to connect the solar panel battery.

Thus, we just need to connect the power pins. Behind the USB connector, we have five pins. From left to right, we have VCC +5V connection, D- (Data -), D+ (Data +), ID (Mode Detect) and Ground. We only connect VCC and Ground to get power.

For additional information, Micro USB Connector Pinout diagram

USB Plug

Solder Header Pins for Arduino

Solder the pins that connect the Arduino Mini Pro to the board.

Header pins
Header pins mounted on main board (Front view)
Header pins soldered on main board (Rear view)

Solder Female board to board connector

This is the connector that connect the Main PCB to the Raspberry Pi.

Female board to board connector
Connector mounted on main board (Front view)
Connector soldered on main board (Rear view)

Solder pump header pin

If you choose to install a pump, solder 3-way header pin with jumper, and JST-2 header plug

3 way header pin
Header pin with jumper
JST2 header plug

Solder additionnal headerpin

Solder this additionnal 2-way header pin

Additional header pin

Solder JST-3 header plug

Solder these 4 plugs that are made to simply connect sensors

JST-3 header plug

Solder MOSFET

Solder MOSFET and respect the direction of its pins (see picture).

MOSFET
MOSFET in place

Solder resistor on main PCB

Solder the two 100 MOhms resistors. This part of the circuit is a voltage divider to measure the solar panel input. As the Arduino works on on 3.3V, it can't measure 5V. The voltage divider reduce the 5V power issued by the USB plug down to 2.5V. We use big resistors in order to reduce energy losses.

It's important to solder these surface-mounted devices before installing the Arduino.

Nota: This part of the circuit is still work in progress

The two 100MOhms SMD resistor soldered on the main PCB

Don't solder resistors on the similar pattern, used to measure AAA power in a previous design. In the current design it is connected to a wrong entry of an Arduino.

Solder FRAM and E/S used on Arduino

  • Solder the red and blue wire on the back of the Arduino on A4 and A5 E/S
Connection on A4 and A5
Connection on A4 and A5 (up)
  • Solder the 6 pins of the FRAM used to connect the FTDI Breakboard
FRAM (facing down)
FRAM (facing up)
  • Solder the following E/S on the Arduino: 2, 4, A2, A3, 9, VCC, RAW and both GND.


  • Solder the red and blue wire on the board to connect the Arduino directly to the Raspberry Pi (red on the left, blue on the right when facing the RPi connector).
Wires connected to the board

Wires

Equip wires with JST type connections.

JST-type connection

Clip the wire in the JST plug (JST-3 for thermal sensors). It doesn't matter where you plug the different wires, just keep the same pattern for both connections.

Equiped wire

Notes on current design

The current PCB design is a work in progress. Several features are not used and/or malfunction.

There is a place to connect a timer 555, but it is not yet used. It was initially a difficult circuity to measure the soil humidity. In the following design we will try to implement the solution used by Hernani Diez of "Re:Farm the City" project.

We also advise you to cut some of the connections (use a cutter to erase the "silver lines"). See below for details:

Red lines indicate where to erase connections

2.2 Solder components on Temperature/Humidity Sensors PCB

Components for Humidity/Temperature Sensor

Solder Resistor

Solder the 470 Ohms SMD resistor on the PCB.

Resistor for RHT03 sensors

Solder RHT03 sensor

Bend the 4 connection of the sensor so you can solder easily.

RHT03 sensor soldered

Solder JST-3 header plug

JST-3 header plug

2.2 Solder components on Light Sensor PCB

Light sensor PCB

The light sensor currently used will be changed in the next designs, because of poor performance.

Light sensor schematics

2.2 Solder components on Pump PCB (Optional)

Pump PCB

2.3 Plug Arduino with Raspberri Pi

Arduino on Raspberry
Arduino on Raspberry

2.4 Install pump (optional)

  • Make holes in plastic boxes, and install wires
Make holes
Wires
Wires
  • Install pump
Pump
  • Wire pump to main PCB
  • Test general setup
General setup

2.5 Wire the modules together

Plug everything

2.6 Lasercut and assemble the box (optional)

Step 3: Setup and connect your sensorbox to the web platform

3.0 What you need

3.1 Create a P2PFoodLab account

  • Go to https://p2pfoodlab.net/community/createaccount, and fill the form. Click 'create account'.
  • Check for the confirmation email. Click on the link in the email.
  • You should see you home page on the P2P Food Lab web site.
  • Click on the 'account' menu in the top-right corner.
  • In the 'OpenSensorData.net' panel, you will find your OpenSensorData key. You will need it in the next section, to configure the sensorbox.

3.2 Configure the RPi

Option 1: Use our install script on a fresh Raspbian installation

1. Install Raspbian on a >4GB CD card. See http://www.raspberrypi.org/downloads. See http://www.raspberrypi.org/documentation/installation/installing-images/README.md for directions to clone the image you get, and https://www.sdcard.org/downloads/formatter_4/ to format SD Card prior of installation.

2. Put the SD card in the RPi and boot the little device. In the blue configuration screen (raspi-config), do the following:

  • expand the file system.
  • set the graphics card memory to a minimum (16MB) (in "Advanced Options/Memory Split", type 16 instead of 64)
  • enable the SSH server (should be enabled by default)
  • disable the desktop at startup (in "Enable Boot to Desktop", select "Console Text console")
  • Choose the correct keyboard layout in "Change Internationalisation Options"


3. Reboot and log into the RPi. User should be "pi" and password "raspberry" - be careful with your keyboard layout if you didn't select the correct internationalisation option

4. You may want to setup your Wifi dongle and configure your RPi to have remote access over your Wifi Network


5.Then run the following command (it may take a while):

$ wget https://github.com/hanappe/p2pfoodlab/raw/master/rpi/install-p2pfoodlab.sh
$ sudo bash install-p2pfoodlab.sh

NOTE: This installation script is meant for Raspberry Pi's that will be used exclusively as a sensorbox. The installation script overwrites existing configuration files without a warning,including the Apache2 configuration files. Don't run the script on a RPi that you're already using for other purposes.

Option 2: use our disk image

  • Download the disk image from https://p2pfoodlab.net/wiki/big-files/p2pfl-2014-06-13.img.zip (900 Mo)
  • Dezip the file
  • Copy the image on your SD Card (Minimal size: 4GB)
  • Edit file /boot/p2pfoodlab.json
  • Insert SD Card in RPi and boot, login (username:pi, password:raspberry)
  • If SD Card is bigger than 4GB, increase image disk by doing
  $ sudo raspi-config

and then select the first menu item

3.3 Configure the Arduino

  • If you haven't got the latest version of the Arduino development environment installed, then download it here.
  • Download the P2P Food Lab code for the Arduino
 git clone https://github.com/hanappe/p2pfoodlab.git
  • Install the two libraries DHT22.zip and Narcoleptic.zip.
  • Connect the Arduino to your laptop using a FTDI serial-to-USB cable.
  • Start the Arduino IDE. Select the correct serial port in the Tools -> Serial Port menu. Select the "Arduino Pro or Pro Mini (3.3V, 8MHz) w/ ATmega328" in the Tools -> Board menu.
  • In Tools > Serial Port menu, make sure you have the right port selected (trial and error?).
  • Open the file p2pfoodlab/arduino/p2pfoodlab/p2pfoodlab.ino
  • Click "Upload" to transfer the code to the Arduino.

Start everything

7. Plug in the USB WiFi, the webcam, and then reboot the RPi.

8. Connect the RPi to a laptop/PC using a cross-cable. The laptop should be configured to obtain an IP address automatically using DHCP.

9. Start a web browser and go to the address http://192.168.3.14/ Log in to the configuration web site. The default password is 'p2pfoodlab'.

The web interface

10. Configure the different sections of the sensorbox:

  • The WiFi settings of your network
  • Give a name to the sensorbox and provide the OpenSensorData.net key to upload the data
  • Set the period with which you want to upload the data, and the webcam photos.
  • Add your public SSH key to the SSH section (needed for the optional test below).

On Linux, copy the output of the command below:

$ cat ~/.ssh/id_rsa.pub

If you don't have any SSH keys, you can generate them as follows:

$ ssh-keygen -t rsa

11. To test the communication with the Arduino, ssh into the RPi and execute the following commands:

$ i2cdetect -y 1

This should show the presence of the Arduino at the address 04.

$ /var/p2pfoodlab/bin/arduino millis

This should return the current clock count of the Arduino.

12. To verify that the data upload:

  • On the RPi, check the ID of the data group:
$ cat /etc/opensensordata/group.json

13. Sit back and relax.

3.4 Configuring the sensorbox

You can configure your sensorbox at any time by typing the IP Address of your sensorbox in a web browser.

You can also configure your sensorbox directly by modifying the file /var/p2pfoodlab/etc/config.json

Recommanded setup

In order to reduce power consumption, we recommend you to use the following guidelines:

  • Take a measure every hour
  • Take a photo once a day
  • Upload data once a day

Like such, the size of the sensorbox memory is just big enough to store the data for a full day and the RPi (which is the biggest power consumer in the setup) will be "alive" only a few minutes per day.

See also https://p2pfoodlab.net/sensorbox/planetelilas/planetelilas/config.json for an example.

For poweruser only

See Sensorbox config commands

3.5 Updating the software afterwards

Updating the Raspberry Pi: Option 1

  • Make sure that the RPi is running. If it has been turned off for power saving, you can boot boot it by bypassing the MOSFET: place a jumper over the two pins in the lower left corner of the board. Alternatively, you can connect a micro USB cable to the power inlet of the RPi.
  • Connect the Ethernet cross-cable from your PC to the RPi.
  • Your laptop should get an IP address such as 192.168.3.1xx.
  • Connect to the web interface at http://192.168.3.14
  • Turn off the energy saving setting in the configuration panel, to avoid that the RPi turns itself off.

NOTES

Debugging over serial connections

DSC06863.png

Step 4: Use your dashboard

4.1 Monitor the greenhouse

4.2 Share your observations