IR Boe bot
bee896
Posts: 25
I am now doing a group project by using Boe Bot and spin language of Tool Propeller. We are required to do the Infrared and Bluetooth Communication. Yet, our coding for IR remote for the boe bot , cannot function.
I attached together with the spin code that I am currently using.
I dunno where the things went wrong so wanna ask for help from you.
Hope to get your reply asap... Thanks...
I attached together with the spin code that I am currently using.
I dunno where the things went wrong so wanna ask for help from you.
Hope to get your reply asap... Thanks...
spin
3K
Comments
Where did you get the code? What have you done so far in terms of testing? What works? When it doesn't work, what happens? How do you have things connected?
Normally with this sort of program, the pieces are tested separately. There are several levels to the IR remote detecting and decoding. Normally, you'd start with the lowest level and test and debug looking at the individual bits and their reception, then you'd add the assembly into bytes and check that, then the assembly into messages and check that. Until and unless you have that working reliably, you wouldn't move on to attempt to control something using IR.
I attached the pictures of my board layout.
we are required to use Ping Sensor,Line Sensor, bluetooth and infrared.
our ping sensor can works currently. The main problem is the infrared for manually control.
It sounds like you need to simplify your program down to just the IR detection stuff and test (and understand) that first before you add anything else (like motion). That's what I would do in your place. I'd take the IR code in your program and add some debug display code that would display some of the variables in your program on the display, more than what's already in your program.
I would probably combine the source code for irDecode with the IR BOE code so it's all in one source file. That makes it easier to add debug code to the irDecode routines. Later, when you've got the code working and you understand it, you can split it up again and add back in the motion code.
I was basically thrown a boebot and needed to solder everything myself using a diagram my dear lecturer drew on the whiteboard.
I'm forced to learn every spin basics in just 2 months time.
That's why I can't provide you with every minute detail that you need. Sorry for that
The best way to learn Spin and the Propeller assembly language is to work through relatively simple examples. Andy Lindsay's Propeller Education Kit tutorials are a good starting point. There's other tutorial information in the "Propeller: Getting Started and Key Thread Index" sticky thread on this forum. You may feel very pressed for time, but you'll learn more quickly and progress faster overall with the project if you invest some time up front to go through the tutorials.
But in the mean time, do you know where I can get any coding samples for an IR Remote Controller assuming that the connections are all correct.
I would first debug the hardware and use either an oscilloscope or logic analyzer or the Propeller itself to tell me if the IR detector is seeing the remote control signal. You could write a simple program that lights an LED on an unused I/O pin when the IR detector output becomes low (it idles at high). You should see the LED blink when you hold a button on the remote control.
Something as simple as this would do:
From what I can see, your irDecode object records the on/off times of the IR signal and saves that to a buffer until there's a long pause. It then goes through the buffer, decides which on/off times are zeroes and which are ones, then groups the information into bytes for the rest of the program to look at.
As I said before, I would then probably combine your two objects into one for debugging purposes and use the video output to display the recorded on/off times so I could tell whether that's being processed properly. If everything looks correct at any given level of processing, I'd then move on to the next higher level.
Since the code (and hardware) worked at some time, I suspect you've got a bad connection somewhere unless you've changed part of the code. In that case, I'd look at the part that you changed.
If You add one LED and resistor to Yours IR receiver You can see activity on it in real time.
IR.rec.out ---- Resistor ----|<-LED--- 3.3V
the bold part doesn't seem to do anything. in this case if iron is greater than 10000 then nothing done.
it seems so strange.
In the routine you included:
I don't think that line of code does anything. It may be left over from previous changes.
Infrared Receiver:
http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/infrared/List/0/SortField/4/ProductID/177/Default.aspx
IR Remote Part Kits:
http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/infrared/List/0/SortField/4/ProductID/177/Default.aspx
before it disappears due to spurious receives.
That is why it works earlier but doesn't work now because the main loop program is slower now because it needs to do
other things like reading PING))) or move the servo motor.
By adding this line to the irDecode.spin file,
it will hold the received code longer to enable the main program to collect it at a later time
See and use attached file.
Good luck.
William:thanks for all the info. since the batteries needed recharge i'll try to update my current situation asap.
if you can refer the first few lines of comments in "IR Boe.spin" in my first post, i guess my lecturer got the coding from you.
It is required to make the decoding accurate.
Bee,
Please pass the new irDecode.spin file to your lecturer and other students so they don't experience the same problem with timing.
If you put "IF iron > 10000" at the end of the loop with nothing after it, it's like saying the following in Basic:
IF iron > 10000 THEN
REM do nothing
ELSE
REM do nothing
ENDIF
If you do want to quit the loop early, use the QUIT statement like
I'm interpreting it in terms of language like C++ where won't do anything unless you type further instructions beneath the IF statement to run something right?
William: OK I'll pass it to him after done testing
The code
just wastes time a bit so the IR decoding is accurate. This wasting of time is required.
Are you using Boe-Boost?
Here is a program I wrote that allows both PING)) and IR to work together on the Propeller Boe Bot.
If you use the IR remote arrow keys, the bot just moves like remote control.
But if you press the Prev Ch key, the bot becomes alive and moves around by itself.
Make sure the IO pin assignments for IR, PING and Head Servo etc is correct before you download the program.
i want to ask about remote control for IR...can i know the coding you use in IR work for all remote control??because as i know the coding used in IR is using the TOSHIBA code..how about if we use UNIVERSAL remote controller??does't it work same as toshiba code 613 or we need change the 613 code ??
If you are using Boe-Boost, you must make sure that the jumper is set to 5v and not Vin.
Well I don't know what's the difference between a Boe-Bot and a Bot-Boost, so I can only assume it's 2 different bot but sharing some part of the coding which actually works.:)
Did you pass the new irDecode.spin to your lecturer?
Are you using 4 batteries or 5 batteries for your Boe-Bot?
It's a 4-battery Boe-Bot and very electric consuming
Then you can use rechargeable batteries.