arduino

DIY Drone/Quad Part 2 – Transmitter

| January 26, 2018
Photo Credit: Keith Knoxsville
A Hen and a Drake Green Teal on the truck bed. Not a limit on anything, but a fun morning out.

In this part of the DIY drone/quad build, we are working on a transmitter. It would have been nice to have an R/C transmitter and receiver on hand, but I didn’t so I put one together from parts on the build sheet from Part 1 of these posts.

I mounted everything to a sheet of plexiglass, but you could use any easy to shape material. I plan to place all my components inside a 3d printed case, but that’s another post.

The parts we’ll use are (1)Arduino Nano, (1)nrf24 module, (1)Battery Holder Or Battery Pack, (2)joysticks, (1)3.3v regulator, and a handful of jumper wires, or you can solder everything together. I also held some things in place with zip ties while prototyping. Adding a switch is optional if you use jumper wires. My prototype on/off switch was a matter of plugging in the power wire to the Arduino VIN pin.

Here is the wiring diagram for the transmitter. We’ll upload and test code via the Arduino IDE later.

What are we doing?

  • We are simply using an Arduino to interpret x and y axis inputs from each joystick. These will be our Throttle, Yaw, Pitch, and Roll.
  • We are sending that signal via the nrf24 radio.
  • The 3.3v regulator is required to supply steady 3.3 volts, and steady amps to the radio, which the Arduino 3v out pin cannot do on its own.
  • A switch is used for on and off power.
  • You might also notice I am adding a power wire to the pin D4. This is optional, I used it as a hardwired way to ensure the Auxiliary 1 channel signal was always set to high. This can have a switch, and probably should have a resistor added, or could be done arbitrarily in the code later. What it does in the end is turn on the stability, AKA ‘angle mode’ on the drone, making it much more flyable off the bat.

Need to step forward or backwards? Use the links for the build series below:

  • Program the transmitter, receiver, and flight controller with an Arduino IDE <- Software Using code called Multiwiiv – Part 6
  • Calibrate the Motors with Multiwii code – Part 7
  • Adjust settings and calibrate our gyro via Multiwii GUI AKA a graphical interface/software for your computer – Part 7
Tags: , , , ,

DIY Drone/Quad Part 1 Intro

| January 10, 2018
Photo Credit: Keith Knoxsville
A Hen and a Drake Green Teal on the truck bed. Not a limit on anything, but a fun morning out.

In this short series of posts, I will show you how to build your own drone, with a transmitter, complete with joysticks, a receiver to receive your instructions, and a flight controller to control the stability and flying characteristics of your quad/drone. The complete build is under 200 bucks, plus or minus a few miscellaneous items.

I also want to make clear, that to use this build guide, a basic knowledge of soldering, electronics, fabrication, and programming, will be necessary. This is not for everyone, but its not beyond learning how to do these things either. While I don’t want to make the build sound complicated, I don’t want to over simplify it either. Expect and or be willing to learn, test, experiment, and be patient; and the experience should be rewarding.

I needed a platform for doing aerial surveys of large agricultural properties for a work contract. Since I have a programming background, experience working with micro-controllers, IOT applications, fabricating, and a history of working with radio control vehicles, it made sense to build a drone from opensource hardware. Building your own drone is actually quite affordable compared to some of the commercial options. With patience, and some tweaking its possible to build a reliable drone.

The drone is a quad copter design that uses arduino microcontrollers for the receiver, the transmitter, and flight controller, an mpu6050 sensor for stabilization, nrf24l transceivers for communication, (4)30amp escs, (4)2212/13 1000kv motors, (4) 10×4 props, (2) 3000mah 30C li-po batteries, and a large frame built from whatever you have on hand. Or you can build it from cheap wood materials.

The cost when finished and flying is less than 200 dollars. Compare that to a much more expensive drone, that you’d never really want ‘modify’ or make your own because of the risk you might damage it. Of course, a more expensive version from more expensive parts can be made. But it hurts a tad less when you crash less expensive materials.

The programming that controls the quad is open source code, uploaded via the Arduino IDE, and configured via Multiwii Software(software that helps you visualize and set settings on the quad/drone). Its based primarily on the hard work and public contributions of many generous programmers, and developers.

To Summarize, We will:

  • Program the transmitter, receiver, and flight controller with an Arduino IDE <- Software Using code called Multiwiiv – Part 6
  • Calibrate the Motors with Multiwii code – Part 7
  • Adjust settings and calibrate our gyro via Multiwii GUI AKA a graphical interface/software for your computer – Part 7
  • Go Fly

In the interest of full disclosure, I make an affiliate commission if you use the links below. So if you find this build log helpful, and want to support more quality posts, then use the comprehensive list of Amazon links below, Thanks.

Electronics Parts List:

  • (4) 2212/13 1000kv motor + 30 amp ESC – http://amzn.to/2BiJhyE
  • (3) Arduino Nanos (receiver board, flight controller, transmitter board- http://amzn.to/2G5Rg5R
  • NRF24L 2.4g transceiver set (will actually transmit and receive signals) – http://amzn.to/2F03Lyc
  • mpu6050 (gyro accellerometer to keep us stable) – http://amzn.to/2F1RXeS
  • (2) 3000mah 30c Lipo Battery – http://amzn.to/2COdaZj
  • 10×4 props w/aluminum hubs (included in motor esc kit
  • (2) 3.3v voltage regulators (provide the right voltage and stable current to the transmitter and receiver) – http://amzn.to/2F1mSrO
  • Power distribution board with Deans Type Plugs – http://amzn.to/2DvWfz7
  • Joysticks (this is a 10 pack for the price of 2, you only need 2 – http://amzn.to/2G50kbc
  • 120 piece Jumper wire set – http://amzn.to/2DqX8of
  • 6AA Battery Box to power the transmitter. However the ideal power source would be a 7 to 12v MAX battery for the Arduino to provide stable power
  • A mix pack of zip ties ranging from 4 inches up to around 10 – Wally World has some fun colors.

Frame Parts List:

These are parts for a wood framed version, its easy to make, and parts can be acquired at a Homedepot, Lowe’s, and any craft store that sells 3mm birch. I went to Michael’s.

  • (2) 36″ 1/2″ square hardwood dowels
  • (2) 200mm x 100mm x 3mm birch plywood
  • (8) 4cm x 6cm x 3mm birch plywood pieces
  • A large variety of 4-40 or m3 screws and nuts
Tags: , , , , , ,

Mushroom Grow Box

| February 20, 2015
Photo Credit: Keith Knoxsville
A Hen and a Drake Green Teal on the truck bed. Not a limit on anything, but a fun morning out.

In an effort to increase mushroom yield, reduce maintenance, and improve environmental controls such as more stable humidity and fresh air exchange, we applied some basic programming, sensoring, and automation to a large clear tote and created an automated mushroom grow box.

Winter-Oyster-Cluster-2

Winter-Oyster-Cluster

DHT11-Sensor

Grow-Box-Revealed

Really-Bare-Bones-Arduino

The basic mushroom growing environment uses 3 simple principles and a few electronic components.

Principles:
Cycle small fan to evacuate the air volume of the growbox, and draw fresh air in through a hepa filter.
Sample Humidity every 60 seconds.
Turn on a small fogger/humidifier until a humidity of 85% is achieved.

If this type of work is beyond the scope of your skills or abilities, the same system can be built with less technical components than those listed below. Although it wouldn’t be as precise, you could just use a mechanical timer to cycle a humidifier on and off a every other hour, or 30 minutes, and adjust the frequency and length of time the humidifier is on, based on the health of any mushrooms. Although you would have to open the lid occasionally to let in fresh air, as its important to mushroom growth.

If you want to build our mushroom grow box, with humidity controller, the list of parts and where we sourced them are further below.

If you just want to learn how the absolute basics to the commercial mushroom production/life cycle, check out our article here: Mushroom Life Cycle.

If you want to learn more about controlling AC power with small programmable boards check out our article on that: Real World Arduino Use.

Components:
Arduino (c programmable microcontroller) Really Bare Bones Arduino $12 usd from ebay
Solid State Relay – Used logic level 120-240vac 3-32vdc driven relay $4 usd from ebay
DHT11 Sensor – Humidity and Temperature Sensor $5 usd electronics parts store
Switchable Power Supply – 25$ usd from Best Buy
Fog Machine – $9 usd with cool LEDs from chinese vendor on ebay
18g Clear Tote – $7 usd Wally World
Gang Box – $1 usd Any hardware store
CPU Fan – $2 usd from ebay
Vacuum Cleaner Hepa Filter – $3 usd On clearance at a discount store

Decide to build the mushroom grow box? Send us an email or leave us a comment and we’ll send you the source code we used for the Arduino. It uses a little bit of simple code, as well as the TimeAlarms and DHT11 libraries made for Arduinos.

Tags: , ,

Real World Arduino Relay Use

| November 29, 2012
Photo Credit: Keith Knoxsville
A Hen and a Drake Green Teal on the truck bed. Not a limit on anything, but a fun morning out.

Microcontrollers, like the Arduino, are great for manipulating lower voltage devices. On their own, they are limited in terms of the amount of voltage and current they can provide to devices. Many first Arduino projects involve motors, and LEDs, that require the use of transistors and additional external power sources.

Relay Wire Diagram Control System

Gardenisto DIY Relays

Gardenisto DIY Arduino Relay

To make full use of a microcontroller for home, garden, and hydroponic system manipulation, such as controlling lighting, pumps, and other AC devices, relays(buy one) need to be used.

If we had a legal team, they’d probably want us to cover our ass against stupidity. So here it is:
Warning! This is not a definitive guide to wiring AC applications, working with live electrical currents is dangerous, and can result in serious injuries, death, or damage to one’s property. Gardenisto and its authors are in No Way responsible for any injuries, damages, or deaths, caused by the use or misuse of the information contained on the Gardenisto website. Use of the information is at one’s own risk.

Now that we can carry on, what is a relay?

Very basically, it is an electrically operated switch, where the signal voltage source is completely isolated from the voltage being switched on or off.

For our example application of manipulating a 150 watt light from a wall outlet, we used a 120 volt 25 amp DC – AC solid state relay that will switch on when a voltage as low as 3 volts is applied. A suitable 10 amp ss relay can be purchased from suppliers like this one – Jameco

This works perfectly with the Arduino 5 volt output, on a digital pin. Not all microcontrollers will operate at 5 volts, some will operate at around 3.3v, so it is critical to understand the hardware you are using, and the interoperability of all your components.

Unplugged, and unpowered, we wired the relay to an appropriate gauge Black AC wire, and finished the AC wiring to an AC wall receptacle mounted to our project enclosure. The receptacle was also selected based on application, and is rated to handle the amperage of our lighting.

While the diagram for wiring a relay is quite simple, simple wiring mistakes can have serious consequences. So be careful, double check yourself, and never work with live electrical currents.

The remaining portion of the system requires the output of the microcontroller. A script turns the digital state of a pin HIGH. The high state toggles the relay, allowing current to flow through the relay.

The other end of the relays DC side is grounded, per the diagram.

Tags: , , , ,

Analog Soil Moisture Sensor

| November 20, 2012
Photo Credit: Keith Knoxsville
A Hen and a Drake Green Teal on the truck bed. Not a limit on anything, but a fun morning out.

There are a lot of DIY moisture sensor articles out there. They are quite basic in principle. Gardenisto articles assume basic knowledge of programming, microcontrollers, and circuit design. We generally prefer to use the Arduino for our applications, as it is so widely used and supported. Our example code is also written in C, and intended for use on the Arduino.

This article focuses on the principle of analog sensor measuring via the Arduino microcontroller, as well as real world usage in a hydroponic coco coir growing medium.

How does a moisture sensor work? As water saturation increases, so does the conductivity of the soil or growing medium. If a small electric current is applied to one sensor lead, then at some fraction of that current should be measurable on another sensor lead a small distance away.

Galvanized nails are also commonly used, simple and effective, but for our basic moisture sensor, we went a little more compact. Two lengths of insulated steel jumper wires are secured in heat shrink tubing. The ends are left exposed. On one end the exposed leads are bent almost 180 degrees back. Caution should was taken to ensure the bent leads are not in contact with one another.

The wires are inserted into a small diameter aluminum tube, just short enough to leave both ends exposed and workable.

DIY Moisture Sensor

Whilst leaving both ends exposed and workable, wrap and secure heat shrink tubing beyond the full length of the tube. The entire thing should feel rigid. This will allow the sensor to hold up to being moved from location to location, and a little abuse.

Our example keeps the wiring fairly simple. It is possible to over complicate the circuit with transistors, or a power source that flips back and forth to prevent an electroplating effect and corrosion of the sensor leads, but for our example we left it simple.

We did add a variable 100k potentiometer to make minor mechanical adjustments.

We ran the power wire to a digital pin, the ground pin to the ground, and the sensor wire to an analog pin on our microcontroller. Our microcontroller is an Arduino, based on the C programming language. They are inexpensive, and have made professional level hardware interfacing available to any hobbyist.

To check soil moisture, we turn on the digital pin which powers the sensor, and give it a fraction of a second to stabilize. We then take analog readings on our analog pin. The readings are done inside of a loop to gather 20 readings before taking the average.


for (i = 0; i < 20; i++){   val = val + analogRead(analogMoisture); } val = val / 20; // take average val = val / 4; // scale to 8 bits (0 - 255)

The digital power pin for the sensor is then turned off. The result is printed to the serial monitor. The following code was extracted from a larger coding block of a more advanced sensor, and formatted to run independently as a simple Arduino program. Entering ‘2’ into the serial monitor will return readings.


/*
* Simple analog moisture sensor.
*
* Leave us a question or comment at http://www.gardenisto.com
*
************************************************************/

int analogMoisture = 0; // pin number of analog moisture sensor readings
int digitalSensorPower = 12; // power up/down pin for sensor readings

int i; // variable used in FOR loops as counter
int val; // variable for reading Moisture status
int intSerialVal = 0;

void setup() {
   pinMode(analogMoisture, INPUT);
   pinMode(digitalSensorPower, OUTPUT);
   Serial.begin(9600);
}

void loop(){

   intSerialVal = Serial.read();
   if ( intSerialVal == '0') {
     digitalWrite(digitalSensorPower, HIGH);
     delay(10); // 10 milisecond delay for stability post power on

     for (i = 0; i < 20; i++){        val = val + analogRead(analogMoisture); // sensor on analog pin 0      }      val = val / 20; // average      val = val / 4; // scale to 8 bits (0 - 255)      Serial.println(val); // Send Sensor Readings      digitalWrite(digitalSensorPower, LOW);      } }

So what does the returning value mean? Before using our sensor on our coco coir growing medium, we created a set of controls by measuring cold water, warm water, and air. The values we attained were: H20 cold:149-146, H20 warm:163-161, Air:0. For a healthy plant in our growing environment, we try and let soil cycle between partially dry, and wet but not over watered. We determined our plant health was optimal when the coco coir moisture level was in the 120-127 range after watering.

Of course, there are additional considerations to make, as you'll notice from the controls. The electro conductiviy of water changes with temperature as well as the level of salinity caused by nutrients in the growing medium. I'll expand on these issues in a more advanced post, but for simple moisture monitoring this method is simple and effective.

Tags: , , ,