Your request is too vague for anyone to help you. We need more details: how will the barcode be accessed--with a scanner? What size gate are we talking about? Power source? Other controls (like an unlock control from inside the gate)?
Also, since you're obviously asking us to help you with your homework (this should really have been posted in the Homework forum), it would help a lot if you showed the slightest bit of initiative and explained what you've figured out and where you're stuck. Don't expect us to just hand you the answer on a silver platter!