Microcontrolled Farm Equipment

by etkoehn in Circuits > Arduino

5498 Views, 31 Favorites, 0 Comments

Microcontrolled Farm Equipment

balescoop1.png
Modified BaleScoop(for picking hay bales out of the field) from manual levers to arduino controlled functions.  
This eliminates the need for 3 sets of hydraulic hoses to only one set and operator can focus more on where they are going rather then controling the implement. This is set up for a "Field Mode" and a Travel Mode", and has 3 switched to still control the implment manually to unload the bales or align bales

Parts Needed
Arduino UNO                                                                                                       
Screw 2 pull springs
 terminal shield for Arduino                                                                          
8 channel Relay board                                                    
10vlt Regulator                                                                           
Enclosure(some type of box to cover electronics)                                                                                                 
Cat 5 Cable                                                                      
Cat 5 coupler                                                                    
Micro switches(you can use all limit switches)                                                         
Limit Switches                                                                 
(3) toggle switches mom/on/mom                                   
Toggle switch on/off/on                                                   
Screw terminal block                                                         
female rv plug
2 prong plug
plastic flex
14 gauge wire  
3 directional solenoid vales with manifold
self drilling/tapping screws
female spade connectors
bolts &nuts (sizes 4-40 and 6-32)
2"x 2' strap steel
1/2" rod
UHMW 1/4 think 4" wide 8" long
small screws
5/16 all thread 8" long and 4 nuts  
2 5/16 bolts 1" long
heat shrink
1 1/2 angle iron 16" Long
2 hinges 2" wide x 4" long
3/8 key stock 3" long

Tools
wire stripper/crimper
leatherman ;)
dikes
small screwdrives
solder gun and solder
Drill and drill bits
sharpie
5/16 tap
cutting lube
grinder and gear
welder and gear
channellocks
open end wrenches 7/8-1 1/8
Torch
Pipe wrench
Fishtape
5/16 nut driver
Jig Saw
Bench vise

Safety First

IMAG0649.jpg
Always be sure to use correct PPE(Person protective equipment) especially with the grinder and welder. As of right now you will only ever get two eyes, there is no Instructable "yet" for a working human eye. You may have more then 2 fingers but I'd like to keep all mine, it just makes life easier. And yet again only 2 ears make sure to wear earplugs when grinding. Always be aware of what and who is around you. And remember that soldering iron is hot and so is what you just welded

Mounting Boards

DSCN3271.JPG
DSCN3272.JPG
DSCN3275.JPG
DSCN3279.JPG
DSCN3278.JPG



Best way I found to mounting the boards in the encloser was to trace the outline and the holes with a sharpie. Place the bolts through and put nuts on them, place the board on the bolts and put nuts on top to fasten. Tighten down
                            

Mounting the Cat5 Coupler

DSCN3284.JPG
DSCN3281.JPG
DSCN3287.JPG
DSCN3285.JPG
DSCN3286.JPG
DSCN3291.JPG
Trace the coupler, drill it out and finish cutting it out with your handy leatherman, glue in place, The cat5 coupler is for the switches on the BaleScoop. The wires go to--- 2 for the swinging hitch(opened and closed), 2 for the Loader(up and down), 1 for bed down, 1 for bale in Loader and 1 to count the second to the last bale, and the last is 5vlt to complete the citcuit.

Toggle Switches & Shield

$T2eC16N,!ygE9s7HHqqEBRng,GzWew~~60_1.jpg
DSCN3291.JPG
DSCN3288.JPG
DSCN3289.JPG
DSCN3382.JPG
Drill 4 holes on the cover of the encloser for the switches, 3 will be for controlling the balescoop and the other to set the "Mode"
 Install The screw Shield, I found this one on ebay, You can build the voltage regulator right on this shield if you want. (I ruined mine shield that's why it is not on it) Install the screw sheild to the Arduino(plug it in) You will need 10k resistors to pull the pins to ground that will be used for switches, solder these to the sheild
Wire 7 of the cat5 wires to the shield terminal output pins and solder the other ends to your switches. These switches are in the circuit to pull the relays to ground(ON). Make sure they are soldered to the correct pins. 2 wires and a ground coming into 1 switch (You will need to jumper the ground to all the switches) and 2 wires going out of the switch to the relay board(One switch controls 2 relays).
Wire the "Mode" switch to the terminal sheild and solder the wires to the switch, 2 outer from the input pins and the center to the 5vlt

Relay Board

DSCN3278.JPG
DSCN3312.JPG
DSCN3315.JPG
DSCN3316.JPG
DSCN3319.JPG
Install female connectors on end of cat5 cables from "control switches" and a ground and 5vlt from the Arduino sheild
Now make a jumper for the 12vlt that will go to the relay switches. Lay the wire down and mark ever place you need a wire. Use a exacto knife to remove insulation, solder  wires going down and tape up so you don't have bare wires

Voltage Regulator

DSCN3279.JPG
DSCN3311.JPG
Not going to tell you how to build a regulator because there is way better ones on here then what i built. But i will tell you what I used
LM317T regulatorm 1uf capacitor,   220ohm resistor and a 10k potentiometer so I could dial in my voltage. The website i learned this from is http://www.reuk.co.uk/Using-The-LM317T-To-Regulate-Voltage.htm
Be sure to fuse the power coming in. I put a fuse holder in the encloser so I know it's always protected, I am useing a 10amp fuse

Wireing the Plugs

DSCN3319.JPG
DSCN3320.JPG
DSCN3318.JPG
Drill two holes in the bottom of encloser, one small for 2 wires and a large one for 7 wires. The small hole is for the power coming into the box and the large is going out. Be sure to splice the 12vlt coming in one to the relay jumper and the other to the voltage regulator, the ground also gets jumped to the revulator but the other goes out the box through the large hole, Color code or mark your wires so you know where they go.
oped the Rv plug up slide the houseing on the wires and start wireing then end peice up, Be sure to set them pairs side my side so you can remeber what is what. tape ever 6" down the wire to hold wires more like a cord, wrap wires in
Use a 2 prong plug for the power coming in. It;s simple easy to unplug and once its wires you cant short it or plug it in wrong

Mounting Manifold

DSCN3292.JPG
DSCN3293.JPG
DSCN3294.JPG
DSCN3295.JPG
DSCN3296.JPG
DSCN3298.JPG
DSCN3309.JPG
Mark the length on the manifold on the 4 strap, cut off and center punch for the holes, Drill the holes 3 sizes smaller then 5/16 this allows a better bite for your bolts, When tapping out holes turn intill it gets tight and then turn backwards, use this back and forth motion so you do not break your tap. Be sure to use lube when tapping and drilling
Set the 4 inch plate on the hitch 30''s back and weld in place. Bolt the manifold in place

Hose Holder and Valves

DSCN3301.JPG
DSCN3303.JPG
DSCN3306.JPG
DSCN3307.JPG
DSCN3309.JPG
cut a 18" of 1/2" rod and and heat and bend @ 6" in two places to make a U, weld in front of hitch.
Now loop the hoses through the holder and connect to the manifold,

Valves and Wireing

IMAG0627.jpg
IMAG0620.jpg
Mount the valves on top on manifold and wire in the male connector Plug. You will need to jumper the ground to all three valves

Making the Switch Mounts

DSCN3388.JPG
DSCN3390.JPG
DSCN3393.JPG
DSCN3391.JPG
DSCN3395.JPG
DSCN3396.JPG
DSCN3397.JPG
DSCN3385.JPG
IMAG0633.jpg
IMAG0634.jpg
IMAG0635.jpg
IMAG0636.jpg
IMAG0637.jpg
Cut the UHMW into 4"x1" strips. Drill one hole on the top to the left, drill 3 holes on the bottom from the left to the middle, move the drill left and right in the middle hole while drilling to make a slot. Set the micro switch on top and scew two screws to fasten to UHMW.

Cutting Mounts for the Limits switches. Mark and cut (3) 5 1/5" long peices out of the 1 1/2" angle. Set the limit switch in the angle and center punch where screw holes are. Drill all 4 holes on 2 of the angle pieces so 10-32 bolt will slide through, on the other still small enough to tap 8-24 into the angle. This last one will be used for the LoaderUP switch. 
 

Mounting the Switches

DSCN3398.JPG
DSCN3346.JPG
IMAG0638.jpg
DSCN3387.JPG
Screw Limit switchs to frame through UHMW with self drilling/tapping screws. 
Weld on angle brackets for Limit switches, remeber to use the tapped base for the LoaderUp switch. For the loader up switch Weld on 3/8 key stock on the loader hinge pin to trip the limit switch, Weld at same angle and bolt through the pin
Be sure to round steel corners off with the grinder to eliminate getting jabbed later on with them.

Wireing the Switches

DSCN3332.JPG
DSCN3350.JPG
DSCN3353.JPG
DSCN3348.JPG
DSCN3344.JPG
DSCN3346.JPG
DSCN3398.JPG
DSCN3400.JPG
DSCN3399.JPG
DSCN3403.JPG
DSCN3387.JPG
Pull the wire through the hitch with fishtape, Put a cat5 cable on the cable at the hitch, be sure to leave plenty of cable to go into that cab. Hook wires up to the screw terminal under bed of bales scoop.
Start pulling wire to switch locations, hitch, loader and bed. Run the cat 5 cable and splice(solder) off that instead of running extra cable everywhere, Solder small globs on end of wires to get a good crimp. Slide on some heat shrink and crimp the female spade connectors on. One cat5 wire branches to the hitch(arm) in out switches and bed down, another cat5 wire branches on the bed to bale engaged, balecounter, loader up and loader down.
Wire cable from the hitch to screw terminal under the bed, wire appropriete wires from switches to  this terminal, GreenW(pin A0)  Arm out postions, Green Arm in, BrownW bed down postions be sure to hook the Brown wire(5vlt) to all the switches
Cable going up under bed, BlueW loader up, Blue loader Down, OrangeW bale engaged, Orange balecounter

Bale Engaging Flap

IMAG0639.jpg
IMAG0640.jpg
IMAG0641.jpg
IMAG0642.jpg
IMAG0648.jpg
IMAG0647.jpg
IMAG0652.jpg
IMAG0654.jpg
IMAG0653.jpg
DSCN3405.JPG
DSCN3404.JPG
DSCN3406.JPG
DSCN3407.JPG
DSCN3408.JPG
DSCN3409.JPG
DSCN3410.JPG
DSCN3411.JPG
DSCN3412.JPG
DSCN3413.JPG
DSCN3416.JPG
Mark and cut 2"x6" out of loader towards the bottom, Cut a 2"x 9 1/2" strap and mark a line 1/2 down and 4 5/8 down. Cut a grove in these lines to assist with bending. Bend the 1/2 peices away from the cut and the 4 5/8 get toward the cut(hold in vise for bending). Find correct angle by holding it in slot in loader and and bending till it fits. Set the piece in the upright position and weld hinge on. Cut 4" of allthread or use a 4" bolt(5/16) heat and 1" from head at 90 degrees, measure 2" and bend at another 90 degrees, bend a slight twist to the right in the bolt. Weld the head of the Bolt to the hinge, weld on the part thats welded to the flap. 
Fit flap in loader and weld other side of hinge to the loader weld a 1" 5/16 bolt on loader 4" up from bolt on hinge. place nuts on both bolts, place spring over bolts and another nut, tighten down. This should hold the flap up and limit switch should ride on flap. You need to make two of these, one for the bale engaged switch and once for the bale counter switch.(loader and bed,the one for bed is smaller in length)

The CODE

thCAXLQXLB.jpg
/*
**This code is for a pro-ag designs Bale Scoop that is set up with directional solenoid valves
**This code will allow you to pick up hay without manually operating switches **Automated**
**7 micro switches are used for end stops 1 on/0ff/on toggle switch and 3 mom/on/mom toggle switches
**1 relay board capable of controlling 6 solenoids 12VDC @ 5 amp
**This code was disigned by Elijah Koehn July 2013.
**This code has been updated 9/25/13 by ______ETK______

*/
//Defining ON and OFF
  #define ON 0
  #define OFF 1 

//Intiating Pin names
//Outputs
#define BedUp 7 
#define BedDown  8
#define ArmOut  9
#define ArmIn  10
#define LoaderDown  11 
#define LoaderUp  12   

//Inputs

#define BedDownS  2
#define AutoPickUpB  3
#define AutoCloseB  4

#define ArmOutS  A0
#define ArmInS  A1
#define LoaderUpS  A2
#define LoaderDownS  A3
#define BaleInS  A4
#define BaleCounterS  A5 
// variables will change:
// variable for reading the Switch status
  int TravelS = 0;             //Switch for Homeing BaleScoop **Travel Mode**
  int FieldS = 0;            // Automaticaly pick up bales **Field Mode**
  int BaleCS = 0;             // 5th Bale Switch  
  int BaleEngagedS = 0;       // Bale in Loader
  int LoaderUS = 0;           // Loader is in up position
  int LoaderDS = 0;           // Loader is in Down position
  int ArmIS = 0;              // Scoop is in closed position
  int ArmOS = 0;              // Scoop is in open position
  int BedDS = 0;              // Bed is in down position
 


void setup() {

  // Turning off all Relays during start up so there is movement of balescoop
digitalWrite(LoaderUp, OFF);
  digitalWrite(LoaderDown, OFF);
  digitalWrite(ArmIn, OFF);
  digitalWrite(ArmOut, OFF);
   digitalWrite(BedDown, OFF);
   digitalWrite(BedUp, OFF);

  // initialize the all Solenoids as outputs   
   pinMode(LoaderUp, OUTPUT);
   pinMode(LoaderDown, OUTPUT);
   pinMode(ArmIn, OUTPUT);
   pinMode(ArmOut, OUTPUT);
   pinMode(BedDown, OUTPUT);
    pinMode (BedUp, OUTPUT);
  // initialize the all Switches as inputs
   pinMode(AutoCloseB, INPUT);
   pinMode(AutoPickUpB, INPUT);
   pinMode(ArmInS, INPUT);
   pinMode(ArmOutS, INPUT);
   pinMode (BaleInS, INPUT);
   pinMode (LoaderDownS, INPUT);
   pinMode (LoaderUpS, INPUT);
   pinMode (BedDownS, INPUT);
   pinMode(BaleCounterS, INPUT);
 

}

void loop(){


  // read the state of the Switch values:
   FieldS = digitalRead(AutoPickUpB);
   TravelS = digitalRead(AutoCloseB);
   LoaderUS = digitalRead(LoaderUpS);
   LoaderDS = digitalRead(LoaderDownS);
   ArmIS = digitalRead(ArmInS);
   ArmOS = digitalRead(ArmOutS);
   BedDS = digitalRead(BedDownS);
   BaleEngagedS = digitalRead(BaleInS);
   BaleCS = digitalRead(BaleCounterS);

//feild Mode

//Step 1
//Makes Sure Loader is out of way
  if (FieldS==HIGH && ArmOS==LOW && LoaderUS==LOW){       //Check positions
  digitalWrite(LoaderUp, ON);}                           //Loader goes up
    if (LoaderUS==HIGH){                                 //Check position
    digitalWrite(LoaderUp, OFF);}                        //Loader stops in up position  

//Step 2
//Makes Arm Swing Out
if (FieldS==HIGH && ArmOS==LOW && LoaderUS==HIGH && BaleEngagedS==LOW){      //Check positions
  digitalWrite(ArmOut, ON);}                                                  //Arm swings out
    if (ArmOS==HIGH){                                                         //Check position
     digitalWrite(ArmOut, OFF);}                                              //Stops arm in out position
//Step 4
//Brings bed down to Home position
if (FieldS==HIGH && LoaderUS==HIGH && ArmOS==HIGH && BedDS==LOW){   // Check positions
digitalWrite(BedDown, ON);   }                                       //Bed goes down to home positon
   if (BedDS==HIGH){                                                  //Check position
    digitalWrite(BedDown, OFF);}                                      // Stop Bed in down Position   

//Step 5 Repeats untill full
//Brings Loader Down, Ready position
if (FieldS==HIGH && ArmOS==HIGH && LoaderUS==HIGH &&LoaderDS==LOW && BaleCS==LOW && BedDS==HIGH){   //Check positions
  digitalWrite(LoaderDown, ON); /*delay (2000); digitalWrite(LoaderDown, OFF); delay (2000);*/}                                                      //Loader goes down
    if (LoaderDS==HIGH) {                                                             //Check position
    digitalWrite(LoaderDown, OFF);}                                                   //Stops Loader in down position

//Step 6 Repeats untill full
// When bale engaged in loader, loader raises up
if (FieldS==HIGH && ArmOS==HIGH && LoaderUS==LOW && BaleEngagedS==HIGH && BedDS==HIGH) {      //Check positions
  digitalWrite(LoaderUp, ON);}                                                  // Loader goes up and repeats Step 3                  

//Step 7
// Once 5thBale switch is engaged, Loader grabs 1 more bale and stops in the up positon
//  swings scoop back in and stops in **Travel Mode**
if (FieldS==HIGH && ArmIS==LOW && BaleCS==HIGH && LoaderUS==HIGH && BaleEngagedS==HIGH){   //Check positions
  digitalWrite(ArmIn, ON);}                                                                 //Arm goes in
   if (ArmIS==HIGH) {                                                                       //Check position
   digitalWrite(ArmIn, OFF);}                                                              //Stops arm closed position



//Auto close **Travel Mode**

//Step 1
// Raises loader up so it doesn't hit arm
if (TravelS==HIGH &&LoaderUS==LOW){      // Check positions
digitalWrite(LoaderUp, ON); }            //If Switch engaged Raise loader up
   if (LoaderUS==HIGH)   {                //Check position
   digitalWrite(LoaderUp, OFF); }         //Stop Loader in up position
  
//Step 2
//Swings Arm to Home position
if (TravelS==HIGH && LoaderUS==HIGH && ArmIS==LOW) { // Check positions
digitalWrite(ArmIn, ON);  }                          //If Switch Engaged and Loader up, Swin Arm in
   if (ArmIS==HIGH){                                  //Check position
   digitalWrite (ArmIn, OFF);}                        //Stop Arm in closed Position
  
//Step 3
//Brings bed down to Home position
if (TravelS==HIGH && LoaderUS==HIGH && ArmIS==HIGH && BedDS==LOW){   // Check positions
digitalWrite(BedDown, ON);   }                                       //Bed goes down to home positon
   if (BedDS==HIGH){                                                  //Check position
    digitalWrite(BedDown, OFF);}                                      // Stop Bed in down Position
}

Action

balescoop1.png

As you can tell it does take a little getting use to when picking them bales up length wise, I also had to change to a heavier spring on the loader switch so it doesn't bounce and engage the switch