LEGO Mindstorms NXT Bin Emptying Robot – Mark II
This is a LEGO Mindstorms NXT "Bin Emptying Robot Mark II". It is part of a larger project I have been working on, my "Ball Sorting Factory". A forklift delivers full Bins of balls to be emptied. The Emptied bins are then taken away to the processing facility to be refilled. The Mark I version worked well, but it was slow and very noisy, unlike this version. Also this version uses a "Ball Repository" to store, mix and reload the Production Line with Balls when the "Ball Sorting Factory" needs them.

The Bin Emptying Machine detects the presence of a Bin when a LASER Beam Reflection is broken from a LASER Target Sensor. The LASER Target Sensor is available in my Online Store.The Bin to be emptied is Lifted up, and then the contents of the bin is emptied out into the "Ball Repository", before being returned back down to the bottom ready for the Forklift to take it away.
The Robot uses LEGO Power Functions Motors instead of the normal LEGO Mindstorms NXT Motors. The main reason for this is their light weight in comparison to the NXT Motors. One LEGO® Power Functions M-Motor is used to tilt the Bins up and down. A second LEGO® Power Functions M-Motor lifts and lowers the bins too and from the "Ball Repository". Both LEGO® Power Functions M-Motor connect to a 36 tooth gear which drives a 12 tooth gear attached to a worm gear arrangement to increase the available to the mechanisms. The 36 and 12 tooth gears increase the final speed at the output of the worm gear arrangement.
The "Ball Repository" is driven by a LEGO® Power Functions XL-Motor connected to a CAM arrangement which drive a series of bars that lifts the Ball up and down to mix them. This mechanism also is capable of moving the balls from the back of the storage container to the GATE, which when open, allows balls to enter the "Ball Sorting Factory's" Ball Race. The "Ball Repository's" GATE is operated (open and Closed) from a RC SERVO Motor connected and controlled from a Mindsensors® 8 Channel Servo Controller.
RobotC Source Code:
#pragma config(Sensor, S1, LASER, sensorLightActive)
#pragma config(Sensor, S2, TILT, sensorTouch)
#pragma config(Sensor, S3, LIFTHOME, sensorTouch)
#pragma config(Sensor, S4, NXTSERVO, sensorI2CCustom)
#pragma config(Motor, motorA, LIFTmotor, tmotorNXT, openLoop)
#pragma config(Motor, motorB, TIPmotor, tmotorNXT, PIDControl, encoder)
#pragma config(Motor, motorC, DISPENSEmotor, tmotorNXT, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
/* -----------------------------------------------------------------------------
Containor Emtying Mechanism
2013 www.rjmcnamara.com
==============================================================================*/
#include "drivers/mindsensors-motormux.h"
#include "drivers/mindensors-servo.h"
int BinCount = 0;
/* -----------------------------------------------------------------------------
Monitor Ball Mixing Mechanism
==============================================================================*/
task Monitor()
{
eraseDisplay();
while (true)
{
nxtDisplayCenteredTextLine(1, "Containor");
nxtDisplayCenteredTextLine(2, "Emptying");
nxtDisplayCenteredTextLine(3, "Machine");
nxtDisplayCenteredTextLine(5, "Bin Count: %d", BinCount);
nxtDisplayCenteredTextLine(7, "LASER Level: %d", SensorValue(LASER));
wait1Msec(250);
}
}
/* -----------------------------------------------------------------------------
Start Restocking Balls
==============================================================================*/
void RestockBalls()
{
// OPEN GATE
NXTServoSetPos(NXTSERVO, 1, 1500, 30);
wait1Msec(2000);
nxtDisplayCenteredTextLine(5, "Restock Balls");
// Start Dispensing Balls
motor[DISPENSEmotor] = 100;
wait1Msec(7000);
motor[DISPENSEmotor] = 0;
// CLOSE GATE
NXTServoSetPos(NXTSERVO, 1, 1150, 30);
wait1Msec(1000);
BinCount = 0;
}
/* -----------------------------------------------------------------------------
Containor Emtying Mechanism
==============================================================================*/
task main()
{
bNoPowerDownOnACAdaptor = true; // will NOT power down when connected to AC adapter
StartTask(Monitor);
// CLOSE GATE
NXTServoSetPos(NXTSERVO, 1, 1150, 30);
wait1Msec(1000);
wait1Msec(1000);
// RESET Containor Elevator
motor[LIFTmotor] = -50;
wait1Msec(200);
while (!SensorValue[LIFTHOME])
{
motor[LIFTmotor] = 50;
}
motor[LIFTmotor] = 0;
wait1Msec(1000);
// RESET Containor Tines
motor[TIPmotor] = 50;
wait1Msec(100);
while (!SensorValue[TILT])
{
motor[TIPmotor] = -50;
}
wait1Msec(100);
motor[TIPmotor] = 0;
wait1Msec(1000);
PlaySound(soundDownwardTones);
/*** Begin Containor Umptying Loop ***/
while (true)
{
if (SensorValue(LASER) < 25) // Detect New Containor
{
BinCount = BinCount + 1;
nMotorEncoder[TIPmotor] = 0;
wait1Msec(2000);
// Tilt Containor Upwards
motor[TIPmotor] = 50;
wait1Msec(1200);
motor[TIPmotor] = 0;
PlaySound(soundUpwardTones);
// Lift Containor Up to Bin
motor[LIFTmotor] = -50;
wait1Msec(500);
while (!SensorValue[LIFTHOME])
{
motor[LIFTmotor] = -100;
}
motor[LIFTmotor] = 0;
wait1Msec(1000);
// Start Ball Mixing
motor[DISPENSEmotor] = -100;
// Tilt Containor into Bin
motor[TIPmotor] = 50;
wait1Msec(5000);
motor[TIPmotor] = 0;
wait1Msec(2000);
// Tilt Containor Downwards
motor[TIPmotor] = -20;
wait1Msec(2500);
motor[TIPmotor] = 0;
wait1Msec(1000);
// RESET Containor Elevator
motor[LIFTmotor] = 50;
wait1Msec(300);
while (!SensorValue[LIFTHOME])
{
motor[LIFTmotor] = 50;
}
motor[LIFTmotor] = 0;
wait1Msec(1000);
// Stop Ball Mixing
motor[DISPENSEmotor] = 0;
// Tilt Containor Home
while (!SensorValue[TILT])
{
motor[TIPmotor] = -20;
}
wait1Msec(100);
motor[TIPmotor] = 0;
nMotorEncoder[TIPmotor] = 0;
PlaySound(soundDownwardTones);
wait1Msec(2000);
// Wait Untill Containor is Removed
while (SensorValue(LASER) < 25)
{
wait1Msec(250);
}
// Count Number of Bins Emptied
if (BinCount == 2) RestockBalls();
}
}
}
loading...
loading...

Download PDF format





[...] LEGO Mindstorms NXT Bin Emptying Robot – Mark II [...]