The redstone detects when the melon grows. It powers the pistons, breaking the melon. Under the dirt and next to it are hoppers. The melon goes in der hoppers, and Into der chest on der right.