# wiki

### Sidebar

offsprings:building:tutorialcaptor

# Captor Building Manual

## Introduction

Hello! Anyway, here we are, you find a lot of materials in your hands, but, you do not know what to do with them, do not worry, in this manual we will try to guide you throughout the process! (Do not forget that you have the captor FAQ for any questions or queries that you may have, the link is in the references section.

Well, but exactly, what are we going to build? What is a Captor Node? its duties? Very briefly, since this manual does not intend to enter into aspects beyond the purely practical, a Captor Node is made to measure the level of contamination of the environment where it is placed, making use of sensors that measure both O3 and NO2. And save these values ​​in the cloud so we can deal with them later.

Let's review before you start, do you have all the materials? (Check the sheet of materials in the annexes !!) All right? let's keep going!

## Building the Hardware:

### Housing:

The first thing we are going to assemble is going to be all the hardware of the node, we will take care of the software later on.

Well, we are going to mechanize the “housing” of the Captor, it is that white color box. You have to make 7 holes in a side, we use the following distribution, even if you can use your own!

Pay special attention to the diameter of the holes you make, since then the connectors of the sensors may not fit. (20mm diameter)

I used this drill to make the holes:

Once this is done, we will proceed to insert the connectors of the “housing” of the sensors, these are the small pieces:

Remember that the one in the center is smaller since it is the one that we will use to install the power cable.

For now let's leave the box on its side, let's focus on making the sensor protectors, prepare the pipes and the heat-shrink tube, we'll need them!

### Sensor Tubes:

The first thing you have to do is cut the PVC pipes (they can be made of any other material, even though this is the most common) You have to cut the 10mm inner diameter tube to a length of 10cm and the 20mm inner diameter tube to 6cm of length. Then we take the shorter thermoretractile tube and we use our personalized tool that in the part of the annexes we explain how to do. Do it as shown in the images below:

Now simply repeat the process another 5 times and we will have this step finished!

Well, we've done a lot of the work, but we're not finished yet, there's the wiring part left!

### Shield Welding:

We are going to focus first on welding all the necessary components to the shield that owns the node, we can see in the following photo all the material that we are going to need in this part:

First we will solder to the shield all the pins that will be necessary to connect it to the arduino Yún.

We take the strips of pins and place them in this way: (It is highly recommended the use of a soldering station, tin with silver mixture and the product “Flux” to have a good weld)

Now that we have the male pins, we have to solder the female connectors where the majority of peripherals are connected, as well as the temperature and humidity sensor, or the O3 / NO2 sensors.

This is how we should stay:

Just remove one pin each four pins to make it easier to solder, these are the pins removed:

Now we will solder our RTC cable configuration, just make it like the photos below:

In the last photo, as you can see, I added some female connectors (the once that belong to T/H sensor)

Ok, we now proceed to solder the resistors that will make our sensors work remember the following:

For an NO2 sensor (MICS-2714) to work, it must have the following resistances: For the parallel: 1x220ohm & 1x330ohm For load resistance: 1x100Kohm

For an O3 sensor (MICS-2614, currently discontinued, we accept suggestions for similar devices with a similar precision / price ratio)

We can see a distribution of 3-NO2: (in this tutorial we won’t use MICS O3 sensor, because, as mentioned, its discontinued.

In the last two photos I added the LED female pins and its resistance (with 100 ohms we should go)

Now we have to solder the wires by the sensor part, it is not very complicated, this is the NO2 sensor that we are going to use:

Just Remove the Sensor Pins, we are not going to use them:

And the just solder it like that:

(PHOTO OF SOLDERED SENSOR)

### Putting all together:

Once the distribution of sensors you want and soldered the sensors, we just have to put everything together, as shown in the following scheme: (remember that before connecting a sensor, it must be installed in the tube that we have built before and this tube inserted in the housing)

(PHOTO OF THE FINAL CONNECTION WITH THE SHIELD)

Now we have to pass the USB power cable and ready, we will have finished Hardware!

## Installing Software:

To install all the software that is necessary to make the hardware run properly you need to do the following:

1. Connect the captor to computer’s wifi → Now via, web navigator write: “192.168.240.1” to access YUN’s GUI (default password: “doghunter” or “arduino”). Change captor name to “captorXXXXX” changing “X” for the captor ID.

1. Flash the Captor image. To do so go to “advanced configuration panel (luci)” (if the Yun’s stock S.O. its different just search for things like “luci”, every Yun must have this panel). Once in this panel just go to:

- Now its time to mount the filesystem on the SD card, to do so, go to the directory where the provided Captor software files are and run this command: “./format_sd_extroot.sh CaptorID_start CaptorID_end”. If you are only creating one node, CaptorID_start = CaptorID_end. - Before uploading our sketch to Arduino CPU, we must do several steps:

1. Upload “Read Accurate Vcc” sketch to Arduino, open the serial monitor and take note of the value that appears.
2. On the CS_API_helper follow the steps that are described there to make the sure the value of the voltatge is filtered.
3. Now its time to upload “CaptorV3_5” arduino file to our Arduino CPU

- Now we have to upload all the software that makes our Captor node work. Like in step 3, you just need to run the command like this: “./upload_software.sh CaptorID_start CaptorID_end 5”. The arguments work as the other script, just ignore that 5 as third argument, just write that :).

1. Download the “Libraries ZIP” and then just run the script like this: “/libs.sh CaptorID_start CaptorID_end 5” This step can take several minutes, just wait patiently.
2. (Just follow this step if you want to use 3G Module to send data). We need to create a network interface for the 3G Module, so first plug it to USB port on the Yun. Then follow this steps:

- Go to “network” → “Add New Interface”

1. Name it like “3gHuawei” and select UMTS mode. Then save the changes.
2. Now, new fields to fill appeared, just fill them in order: /dev/TTYUSB0 → UMTS/GPRS → APM = em
3. Now you need to create the RSA key on the yun, Just follow “install_captor.sh” steps to do so. You don’t have to do server part, just send me the key creating a question on our FAQ.
4. Just activate your SIM, on your SIM provider, and make sure the 3G module makes the attach to your ISP.

## Annexes:

Make our custom tube centering tool: