PIC based IR RC lawn mower - Page 1
Forum section: electronics / projects

author: commerou
author_rank: Contributor
timestamp: December 11, 2013, 01:24:14 pm
content: Hi guysWe are currently struggeling with a school project, and hope some clever guys on the EEVBlog forum can help.We are making a infrared rc lawn mower using a PIC16F84A as a controller.To control the direction the lawn mower is moving we are using two bi-polar stepper motors, one on each back wheel. Our idea was to control either forward or backwards motion on the steppers individually to turn left, right, forwards and backwards.We have made a controller for a stepper motor with three toggle switches, one for right, one for left and one for stop/lock.We have a 36 kHz IR reciever but we are having trouble figuring out how to build it and program the PIC.Hope you guys have some great ideas.Thanks.Best regardsCommeroups. we have to use assembly

author: HackedFridgeMagnet
author_rank: Super Contributor
timestamp: December 11, 2013, 01:31:38 pm
content: Write in C, compile and then put a few comments and labels in the dissasembly.When its going come and test it on my lawn.

author: jonw0224
author_rank: Contributor
timestamp: December 17, 2013, 02:11:01 pm
content: Let's take it one step at a time, I see about a dozen questions here:(1) How to program a PIC?If you're limited to assembly, the best tool is to use MPLab with a PICKIT2 or PICKIT3 programmer. If you have a third party programmer, you will need to use the third party software if it doesn't integrate with MPLab. I've found the PICKIT software more flexible than MPLab for programming as well.(2) How to write assembly?Hopefully this isn't your question as it could take a long time to answer.(3) How to drive a bipolar stepper motor?A bipolar is harder than a unipolar. You will need to use an H-Bridge circuit for each coil, because you will need to pull one side of the coil low and pull the other side high to energize that coil. And then you need to operate the coils in the correct sequence to get a rotation. Not too hard, but I'd tackle that part of the project independently.(4) How to interface an IR sensor?An IR sensor should give you a pulse train for each command. You just need to differentiate the pulses for each command you are using. The pulse train depends on the remote and the protocol used. This part of the project can be developed independently from turning the motors.(5) Testing, testing, testing. May I suggest either a series of indicator lights or an interface to an LCD for debugging purposes. A couple of push button switches may help too, that way you can simulate commands for the motors or see if you resolve the IR sensor command correctly.(6) Putting it together. Copy, paste, or include your assembly files into a main program. Pass the IR commands to the motor controller. Stick a fork in it, you're done!Another general comment, I thought about building an autonomous lawn mower, but never even started. A remote control lawn mower doesn't solve any problems for me. It's not that I find mowing a lawn unenjoyable and need a remote control lawn mower to make it fun. It's that I can't find the time to mow my lawn and do the other things I'd like to do. So, I just pay someone else to mow it. I need a Roomba with lawn mower blades and a humanoid robot to operate my weed eater.Good luck on your project!

author: zapta
author_rank: Super Contributor
timestamp: December 17, 2013, 04:11:08 pm
content: Dave made a video about IR controller, it focuses on the transmitter side but will give you idea about the signalshttp://fixyt.com/watch?v=BUvFGTxZBG8Receiving is more difficult because you may have noise (IR signal, not acoustic) and may need some filtering. If you can get some smart IR receiver module (don't know if they exist) life may be easier. What IR receiver do you have?Was IR communication dictated to you? One alternative is to use model RC remote control. You get the transmitter in a nice box with joysticks, etc, and the signals on the receiver side are easier to process by a pic (just measure the variable pulse width).BTW, I presume that your school will take care of the safety issues. Having an uncontrolled lawn mower running around may be dangerous.

author: kile
author_rank: Contributor
timestamp: December 18, 2013, 11:16:40 am
content: A lawnmower should be used outside, which means in direct sunlight. Won't the sunlight saturate the IR wavelengths making communication between the remote controller and the receiver impossible?I'm a beginner, but the first microcontroller project I did used IR remotes, and the "indoors only" was the first lesson I learned.

author: RoadRunner
author_rank: Frequent Contributor
timestamp: December 18, 2013, 12:14:02 pm
content: may be these post are helpfulhttp://www.circuitvalley.com/2013/09/nec-protocol-ir-infrared-remote-control.htmlhttp://www.circuitvalley.com/2012/09/infrared-ir-nec-microcontroller-pic-avr.html

author: commerou
author_rank: Contributor
timestamp: February 26, 2014, 11:26:24 pm
content: Hi guys, thanks for the answers, we have just finished the project and we ended up using a TSOP1736 ir reciever and a LM2917 to get different voltages with different frequencies.We then made a voltage divider to get 3 referenece voltages and used 3 opamps to get high og low with the different frequencies.Then used some logic gates to get the right signals, and just pulled a pin low on the pic when the motors had to turn.We did this because we were limited to two PIC16f84A and we used those to drive the stepper motors.Im sure this was not the most elegent solution but we made it work in the end.And yes, the infra red was a bad idea, but apparently it is the only form of wireless communication we were allowed to use. The range was around 5 meters

author: commerou
author_rank: Contributor
timestamp: February 26, 2014, 11:31:42 pm
content: Maybe one of you guys have an idea for our next project which starts in two weeks? Only the sky is the limitPlease feel free to share your most crazy ideas

author: Psi
author_rank: Super Contributor
timestamp: February 27, 2014, 12:29:40 am
content: IR code is pretty simple, just a series of pulses which vary by width to indicate 0 or 1.The start pulse is special and extra long.Feed the signal into the MCU interrupt pin set for falling edge triggerRead/reset the MCU's hardware timer every time you get a falling edge interrupt.You can then classify each pulse as either zero or one by the timed value of its length.Once you have that data its easy to perform an action if the data matches a pattern for a specific button.

author: sacherjj
author_rank: Frequent Contributor
timestamp: February 27, 2014, 01:08:33 am
content: Quote from: kile on December 18, 2013, 11:16:40 amI certainly can. You need to have a receiver that has enough range that it can still see a varying signal when fully sunlight is hitting it. Then, the high pass filter removed the environmental light bias and gives you the pulsed carrier (40 kHz ish).