Skip navigation
2016
troush118

PLX-DAQ Soil Temp Monitor

Posted by troush118 Apr 8, 2016

A cool and free software download that is pretty awesome. People may already know about this but I just found it last night. It's called PLX-DAQ from the Parallax website. Instead of buying a data logger shield for the Arduino and having to take the memory card out when you want to look at the data this cool software lets you connect right to you Arduino. I think you can have up to 20 inputs and it sends it right to excel. It's just an excel file with a Macro created to connect to your Arduino and some other micro controllers. It does not show that it is compatible with the Arduino but it worked fine for me. You write your normal program in the Arduino IDE. Upload the code. Click connect on the excel macro. And boom you're off to the races.

 

Project:

 

I have my Arduino set up as of last night measuring just room temperature right now and recording it in excel every half hour. Once the data is in excel it is putting it in a pretty graph. What I am going to do with it is put one temperature sensor in a pot of soil (or three) and then leave one outside in the room temperature. What I want to do is see how the soil temperature varies based on the surrounding air while it is in a bucket and it somewhat exposed as an "object." I would like to get  a couple different types of soil (i.e. top soil, sandy soil, clay soil, and rocky soil) that way I can see if there is a thermal efficiency (Maybe that's the word I'm looking for?) between different types of soil. Once I determine that at a small scale I want to take the whole thing outside and see how the ground soil at my house changes based on the above ground temperature.

 

End Goal:

 

The goal I am trying to achieve because I apparently have nothing better to do with my life is make a determine how quickly the soil temperature changes based on outside temperature to see if my garden will survive a night outside in the cold. By knowing this I could look at a weather forecast to see what the night temperature is supposed to be and then know if I have to cover my plants or if they will survive. Maybe eventually even have some wifi shield for the Arduino look the weather up and determine for itself and then notify me via email if I need to go cover them.

 

This project will put me one step closer to an automated garden. I already have an automated watering system based on Arduino clock controlling a solenoid for a set time to allow the specific amount of water needed to individual rows.

In certain cases you may need to use motors for different purposes. Depending on the experiment or the device you are building, the type of motor to use can be different. In this series of posts I will show you how to use those motors with Arduino.

 

Servo Motors

Servo motors are motors for which you can control accurately enough the speed and the angle of rotation. They can be used to precisely move parts in your device. For examples, in physics experiment you can use a servo motor to hold a ball in a given position and release it at a given time to study its motion.

 

As most of the motors, servo motors can just rotate around their axis. However, with a bit of mechanics you can realise any kind of movement. To have an idea of what you can do with a rotating axis and some mechanics, just read the article on http://makezine.com/2015/04/20/understand-1700-mechanical-linkages-helpful-animations/.

 

Controlling a servo motor is incredibly easy with Arduino. Servo motors have three wires: usually coloured in black, red and white. The black one must be connected to the GND pin of the Arduino, while the red one to the 5V pin. They are used to feed the motor with some power. The third wire is used to control it. Any servo motor works receiving voltage pulses of a given width. Pulses are repeated at regular intervals (e.g. 20 ms), while the duration of a single pulse determines the rotation angle of the motor around its axis or its speed.

 

Given the working principle of a servo motor, you will not be surprised to know that you need to connect the control wire to one of the PWM (Pulse Width Modulation) pins of Arduino. PWM pins can be configured such that they provide voltage pulses at given interval with the chosen duty cycle. The duty cycle of a PWM pin is the faction of time for which the pin is at its highest voltage. An excellent tutorial on PWM pins is given here.

 

Putting the pin to zero makes the PWM pin to stay off, while putting it at its maximum value of 255 makes the pin to stay always on, i.e. with a duty cycle of 100%. In order to observe a square wave on the pin you must put it at 128, such that f=128/255=0.5 and the duty cycle is 50%. Any other number makes the pin to produce a square wave whose pulse width ranges from 0 to T, where T depends on the Arduino flavour. On the Arduino UNO T is about 2 ms.

 

With Arduino you don't need to compute the values yourself to control a servo motor. The Servo library is in fact available for use and provides all the relevant configurations automatically. Consider the following sketch:

 

#include <Servo.h>

 

Servo myservo;

 

void setup() {

  myservo.attach(9);

}

 

void loop() {

    myservo.write(90);        

    delay(1500);

    myservo.write(0);

    delay(1500);                     

}

The attach() method in setup() just tells Arduino to which pin the motor is attached, represented by the object myservo, defined as a member of the main class (Servo myservo). In the example the servo is attached to pin 9. You can then provide an angle, in degrees, to the write() method. Its effect depends on which type of servo motor you have.

 

There are, in fact, two types of servo motors: continuous rotation and standard. The write() command makes a standard servo rotate of the specified angle. A call to

 

  myservo.write(90);

with a standard servo makes it rotate of 90 degrees. With the above sketch a servo of this type rotates of 90 degrees, then holds that position for 1.5 s, before returning at its initial position, where it stays for 1.5 s. Being in the loop the above rotations are repeated continuously.

 

When a servo motor of this type is powered and is receiving a train of pulses, it resists to forces applied to it holding its position. Of course you cannot apply forces too large, if you do not want to damage your servo. The maximum torque you can exert on the servo axis is one of the characteristics you can find on the servo data sheet.

 

The maximum torque is usually measured in kg·cm and is the product of the mass of a weight suspended at a given distance on a beam mounted on the motor axis. Using a servo whose maximum torque is 10 kg·cm you can suspend 10 kg at a distance of 1 cm from the axis as well as 1 kg at 10 cm. The larger the distance, the lower the weight the servo can tolerate. Needless to say, it is not a good idea to use a servo close to its limit. If you need a given torque, choose a servo that can tolerate at least twice that torque.

 

In order to compute the torque in N·cm it is enough to multiply the torque in kg·cm by 9.8, i.e. by the gravitational acceleration. In this case a servo whose maximum torque is 10 kg·cm can tolerate a force acting 1 cm far from the axis of 10·9.8=98 N, or a force of 9.8 N acting at a distance of 10 cm from the axis.

 

Continuos rotation servo motors, instead, rotate clockwise or anticlockwise until they are powered. The number passed to the write() method represents the rotation speed: numbers from 0 to 89 make the motor axis rotate anticlockwise (seen from above), while numbers from 91 to 180 make it rotating clockwise. The maximum speed is attained for 0 or 180. The higher the number, the slower the speed if the number is less than 90. On the contrary, if the number is larger than 90, the speed increases with the number. Setting the speed at 90 makes the servo stop rotating. In the above sketch, then the servo rotates anticlockwise for 1.5 s, then stops for other 1.5 s and so on.

 

Here you can find the motor we used for our tests, but it is plenty of them in the Farnell Electronics store. Below is a video showing our continuous rotation servo working with the sketch outlined above.

 

 

This post appears on my personal blog, too (https://giovanniorgantini.wordpress.com/) and its content will be part of my freely available publication Scientific Arduino available here.

Filter Blog

By date: By tag: