Assistance with Wireless Remote Control.

Mattc141

New Member
Hey Guys,

Made a few things with Picaxe equipment before but this is my first robot. It is actually for a project at school and our brief is to create a prototype for a Rover that would be able to carry a small labatory.

We are basing our design of this Spirit II rover we saw here: http://beatty-robotics.com/spirit-ii-mars-rover We really liked how it moved as it was simple yet effective and had good suspension.

Anyway, I wrote a program for it as if it had switches on the rover and it works the same as the one on the website. Just need some assistance in working out how to make it go wirelessly. Not asking you to do it for me, just some guidance and maybe a few lines of code to get me started.

Thanks,

Matt :eek:




Code:
; GOLD CREST PROJECT - ROVER LAB


;=============================== START =============================
;===================================================================


Pause 500				; Give Everything Time to Initilize





Init:				; Defining Input & Output Pins.
	

	; PORT A
	input A.0		; Forward Input
	input A.1		; Reverse Input
	input A.2		; Left Input
	input A.3		; Right Input


	; PORT B
	output B.0		; Servo 1
	output B.1		; Servo 2
	
	output B.2		; Servo 3
	output B.3		; Servo 4
	
	output B.4		; Input 1 on L293D x 2
	output B.5		; Input 2 on L293D x 2
	
	output B.6		; Input 3 on L293D x 2
	output B.7		; Input 4 on L293D x 2
	
	
	; PORT C
	output C.0		; Input 1 on L293D x 3
	output C.1		; Input 2 on L293D x 3
	
	output C.2		; Input 3 on L293D x 3
	output C.3		; Input 4 on L293D x 3
	
	output C.4		; Input 1 on L293D x 1
	output C.5		; Input 2 on L293D x 1
	output C.6		; Input 3 on L293D x 1
	output C.7		; Input 4 on L293D x 1
	 
	
	Servo B.0,150	; Init Servo 1
	Servo B.1,150	; Init Servo 2
	Servo B.2,150	; Init Servo 3
	Servo B.3,150	; Init Servo 4

		goto ButtonTest


;===================================================================
		
ButtonTest:


	if PinA.0 = 0 AND PinA.1 = 0 AND PinA.2 = 0 AND PinA.3 = 0 then	; If the Forward and Reverse Switch is in the Off Position && Left and Right Switch is in the Off Position.
		
		low C.4		; Turn all Motors Off
		low C.5
		
		low C.6
		low C.7
		 
		low B.4
		low B.5
		 
		low B.6 
		low B.7 
		
		low C.0 
		low C.1 
		
		low C.2 
		low C.3
		
		
		
	elseif PinA.0 = 1 AND PinA.2 = 0 AND PinA.3 = 0 then	; If the Forward Switch is in the On Position && Left and Right Switch is in the Off Position.
	
		low C.4		; Set all Motors to Clockwise.
		High C.5
		
		low C.6
		High C.7
		
		low B.4
		High B.5
		
		low B.6
		High B.7
		 
		low C.0
		High C.1
		
		low C.2
		High C.3
		
		
	elseif PinA.1 = 1 AND PinA.2 = 0 AND PinA.3 = 0 then	; If the Reverse Switch is in the On Position && Left and Right Switch is in the Off Position.
	
		High C.4		; Set all Motors to Anti - Clockwise.
		low C.5
		
		High C.6
		low C.7
		
		High B.4
		low B.5
		
		High B.6
		low B.7
		
		High C.0
		low C.1
		
		High C.2
		low C.3
		
		
	elseif PinA.2 = 1 AND PinA.0 = 0 AND PinA.1 = 0 then  ; If the Left Switch is in the On Position && Forward and Reverse Switch is in the Off Position.
	
		ServoPos B.0,200		; Put Outer Wheels in Turning Positions.
		ServoPos B.1,100
		ServoPos B.2,200
		ServoPos B.3,100
		
		
		High C.4		; Set all Motors to Anti - Clockwise - Left Rotation.
		low C.5
		
		High C.6
		low C.7
		
		High B.4
		low B.5
		
		High B.6
		low B.7
		
		High C.0
		low C.1
		
		High C.2
		low C.3
		
		
	elseif PinA.3 = 1 AND PinA.0 = 0 AND PinA.1 = 0 then  ; If the Right Switch is in the On Position && Forward and Reverse Switch is in the Off Position.
	
		ServoPos B.0,200		; Put Outer Wheels in Turning Positions.
		ServoPos B.1,100
		ServoPos B.2,200
		ServoPos B.3,100
		
		
		low C.4		; Set all Motors to Clockwise.
		High C.5
		
		low C.6
		High C.7
		
		low B.4
		High B.5
		
		low B.6
		High B.7
		 
		low C.0
		High C.1
		
		low C.2
		High C.3
		
	
	
	endif
	
			goto ButtonTest

;===================================================================
;=============================== END ===============================
 

Attachments

nick12ab

Senior Member
Welcome to the PICAXE Forum!
Anyway, I wrote a program for it as if it had switches on the rover and it works the same as the one on the website. Just need some assistance in working out how to make it go wirelessly. Not asking you to do it for me, just some guidance and maybe a few lines of code to get me started.
All that depends on what you want to use for wireless communications. Have you decided yet? The code will be very different for each option. Options that can be done with PICAXE include:
 

Mattc141

New Member
Hi there!

Thanks for the reply. I looked at the XRF/ERF Module or even XBEE as a possible option as I read that it is more reliable and has an increased range than the 433 Modules.
The XBEE is alot if you have to get two of them so the XRF may be a better option however it depends on what will give reliable results. This after all is the most important part of the systems.
I have never used either of them before so I am unsure on what is best, but I would say it is between them two.

Thanks,

Matt
 

Jamster

Senior Member
If you're using high and low commands then they automaticly set the pin as an output. Another thing to look at might be the pinsC/pinsB and dirsC/dirsB variables (manual 2 variables section near the start), they could make your code a lot shorter :)

Jamster
 

russbow

Senior Member
You program fails the syntax check. Look at your init: section. If they are statements on the uses of the ports, then each line should start with a ' to rem them out.
You could consider using them as symbols ( man 2, page 239 ) to help in following the code further on.
 

nick12ab

Senior Member
The XBEE is alot if you have to get two of them so the XRF may be a better option however it depends on what will give reliable results. This after all is the most important part of the systems.
You could always add software error detection (and possibly error correction too) if the wireless signals are unreliable.

The only one I've ever used is infra red, which is very cheap, reliable but has a short range.
 

Mattc141

New Member
You program fails the syntax check. Look at your init: section. If they are statements on the uses of the ports, then each line should start with a ' to rem them out.
You could consider using them as symbols ( man 2, page 239 ) to help in following the code further on.
The program doesn't fail the syntax check... Where it says Ports it is a comment so it starts with a Semi Colon...
 

Mattc141

New Member
Thanks, Which would be the best way to go about Infra Red then. What hardware would you need and what range would it have? - I want to make my own remote control as it will do other things as well...

Matt
 

nick12ab

Senior Member
Thanks, Which would be the best way to go about Infra Red then. What hardware would you need and what range would it have? - I want to make my own remote control as it will do other things as well...
Not so fast! Just because it's the only thing I've used doesn't mean that it's the best thing to use!

Is poor range and the line of sight requirement for IR acceptable for your project? If not, then IR is not acceptable.

If you want to use IR then you will need a commonly available and low cost 40KHz or 38KHz 3-pin IR receiver for the receiving PICAXE and just a IR LED for the sending PICAXE. The irin and irout commands will do all the hard work for you.
 

Mattc141

New Member
Thanks for the reply. Sorry It seems Im trying to go a bit to fast...

I dont think that a poor range and a line of sight requirament will be very good for our project as it is supossed to be a prototype rover for another planet.

I think that URF Modules may be the most appropiate option as they have a good transmission distance, do not require line of sight, transmitt in multiple directions (as far as I know) and look good value for money.

How then would I go about incorparating this into my project??

Many Thanks,

Matt


EDIT: Just on a side note is there any way to simulate servo movement in the Programming Editor??

Thanks.
 
Last edited:

nick12ab

Senior Member
I dont think that a poor range and a line of sight requirament will be very good for our project as it is supossed to be a prototype rover for another planet.
Well in that case you'll need satellite communications.

Then I must be missing something important.

View attachment 12985
Yes you are. Perhaps you haven't selected a PICAXE which supports port A. It's not entirely your fault - the OP should have used the #picaxe directive.

thing.png
 

Mattc141

New Member
It is only a 'Prototype', so the range only needs to be able to make it drive around the carpark. Max 150m but shorter is fine. I saw the ERF Module has a range of 500m Max so that would probably be our best option.

By the way the program was written in 28X2 Mode.

Thanks.
 

Mattc141

New Member
Thank you :rolleyes:



The #picaxe directive is quite useful.IMHO should be mandatory in the P.E.
Sorry did not think to state what chip I was using... :eek:

Anyway,

I have done some research and think I have come up with a suitable program for a Remote Control and Receiver Unit that will drive the rover using the ERF Module.

Any advice would be appreciated.

Thanks,

Matt
 

Attachments

Last edited:
Top