Picaxe 08 ^ 433MHz Tx Rx

old plumber

New Member
Hello all,
I know this is probably ancient to you however I've been trying to implement this code from David Lincoln's book "Programming and Customizing the Picaxe Microcontroller" to make a remote controller out of some old components I have on hand.
I have been able to get Tx and Rx to communicate however the Output LED's are always ON and then go Off when the TX buttons are pressed, opposite to what is stated in the comments.
Can someone please help me alter the RX code to reverse the outputs?
Thank you in anticipation.

1587175121857.png 1587173856886.png 1587174912921.png 1587174486982.png
 

premelec

Senior Member
A hardware fix would be to just wire the LEDs so they go off opposite to what is wired now - for instance wire one end to V+ instead of V-... ;-0 [reversing LED polarity as well... ]
 

old plumber

New Member
Thank you premelec.
Did what you said and it works fine, OF COURSE, simple solution.
Problem is I don't fully understand the code, but I will continue studying it.
Thanks again.
 

AllyCat

Senior Member
Hi,

The "software" solution would have been to add an "XOR %10111" to the pins = serdata line, ie. PINS = SERDATA XOR %10111 to invert the pins' polarity in the receiver program.

Rather disconcerting, the transmitter program is using a T2400 baud polarity, which means that the output pin "Idles high", so the transmitter will be operating all the time that power is applied but a button is NOT pressed. That is "illegal" use of the 433 MHz "ISM" (Industrial, Scientific and Medical) band in many countries of the World, certainly Australia, because it can block the use of other devices such as car key fobs, wireless doorbells, thermostats, Weather Stations, etc. etc.. It will also drain the transmitter battery much faster than necessary (perhaps 50 times faster than the PICaxe alone ! ). :(

Changing to N2400 might be sufficient (or even 1200 or 600 may be more appropriate for low-cost 433 MHz modules), but it would be better to use defined "run in" and "shut down" control signals, perhaps with the more sophisticated PICaxe commands such as a serial data "Qualifier", or the RFIN / RFOUT commands (not in 08M2).

Cheers, Alan.
 

old plumber

New Member
Thanks Alan for your detailed reply.
I'm thinking and hoping there is a simpler solution for my rather simple requirements.

My ultimate goal is to control two servos and a solenoid water valve on my chook shed to squirt pesty birds, while sitting on my verandah. The pesky birds fly off as soon as I leave my verandah.
I have on hand a couple of Picaxe 08, 08M2, 14M2, 18M2 and two pairs of 433MHz Tx Rx

I have been trying to find or learn code to transmit a joystick and button to the receiver at the sharp end, i.e. the chook shed.
However I a quite slow at coding and therefore have not gotten past the examples from David Lincoln's book, which I don't understand fully anyway.
You pointing out that it is illegal makes it even less attractive to progress with.
I would greatly appreciate you pointing me in a better direction to achieve my goal in a simpler way if possible.

Regards, Stephen
 

AllyCat

Senior Member
Hi Stephen,

First, I think you need to tell us exactly which "pairs of Tx Rx" that you have on hand - either a web link or a simple closeup photo. Some are better than others - or more specifically some are MUCH worse than others. Also an indication of the distance to the chook shed (and any potential obstructions to the radio signal) and what power supply is available for the receiver (solar might be feasible)?

Unfortunately, radio transmission techniques are not "easy" and I can understand why David used such simple demonstration code. The "illegality" is possibly not much of an issue for a simple table-top demonstration, or maybe a farmstead in Australia, but particularly as you have 14 and 18 pin M2s, it's much better to do the job "properly", probably taking advantage of the PICaxe's RFIN and RFOUT commands. Also, even if you don't cause radio interference to others, you might suddenly find that you can't open your car doors; I have to confess it happened to me some time ago, until I realised what I'd done (or rather not done). :)

Cheers, Alan.
 

old plumber

New Member
www.jaycar.com.au is my supplier, part no zw-3100 & zw-3102
Distance to shed about 30 metres, 100 ft. no obstructions, only one neighbour, no rf car lock either.
Remote power from recycled S3 lipo pack & solar charging to power mechatronics.
Tomorrow I will check if the system communicates over the 30 metres and let you know, plus some pics.
Hope you can stay safe in London as we are here in Barrington NSW,
Regards, Stephen
 

AllyCat

Senior Member
Hi Stephen,

I haven't any experience of those particular RX and TX modules but they are at least from a reputable source. The specifications are not great at +3dBm (= 2 mW) transmitter power and -104 dB receiver sensitivity, but are perhaps more "honest" than some Chinese specs, So you may need to use relatively good-performing antennas: For the receiver that's a "quarter-wave monopole" i.e. a vertical "piece of wire" (or better a rod) 17 cms long - the length is important, bigger is not necessarily better. Ideally the top (free end) of the antenna should be in "free air", but stapling it to say a wooden frame or panel may be satisfactory. For that relatively low transmitter power, start with a similar 17 cms vertical "whip" antenna; later you might be able to try a smaller helical type, but they don't work any better (very probably worse), to suit a more convenient "hand held" remote control.

There's no harm in trying David's code (I'd use 1200 baud) to test the range, but the PICaxe RFOUT and RFIN commands are probably a far better way to proceed. They're "designed for the job" and already resident in the 14/18M2+ chips. I believe the protocol also could be emulated by software in the 08M2, but let's Keep It SimpleS for now. Don't worry too much about the software yet, there are people here who will help out over any specific details and some who may even take pity and post a fully functional program. ;)

Yes, we've largely "isolated" ourselves here in the Surrey Hills, more rural than your (NSW) Surry Hills, but not as isolated as Barrington. :)

Cheers, Alan.
 

old plumber

New Member
Hi Alan,
As per your advice I attached 17cm solid wire antennae to Tx & Rx, Then an LED light to the Rx output, via relay circuit and separate power supply.
Mounted all on the chook shed roof and started walking.
Worked perfectly out to 35 metres but started petering out at 45metres after which I would have had to go onto the roadway.
I know it's primitive and basic, but I was still excited with my small success.
Interestingly, but as you predicted using T2400 I think, the light would flicker ON if I stood in the way of the signal.
Tomorrow I will replace with N2400 or N1200. I presume I will need to alter both Tx & Rx ?
I will also rebuild using the 14M2 chips and attempt RFOUT and RFIN
Have attached pics of my current build. There's an 08 and 08M2 in those jungles.
Regards, Stephen08 M2 Rx Bread Board.jpg08 Tx Bread Board.JPG
 

manuka

Senior Member
Old plumber: Hi Alan from the Shakey Isles - I did a good deal of hands on work with 433MHz modules some decades back & used them extensively in education, Silicon Chip articles & diverse Instructables. See perhaps => https://www.instructables.com/id/433-MHz-UHF-lost-model-radio-beacon/

Note that none of the "Orcon" links remain active - this was another era & I've since moved on with RF & micro technologies ...

However I recall Jaycar's ZW3102 receiver is a great performer (& also suits flexible supply voltages ?) but their "matching" ZW3100 transmitter (with only ~2mW power) is indeed hopelessly weak. Suggest you instead use a superior (& cheaper !) ~25mW Dorji one in (as mentioned in the Instructable above- sample beacon circuitry attached ). This works well with the Jaycar Rx & gives 100m+ ranges. I've a swag of them here still & could even post you a few when lock down eases. Regards -Stan.
 

Attachments

Last edited:

AllyCat

Senior Member
Hi,

@Stan: Thanks for the information. I must admit that I was surprised by the low (2 mW) transmitter output power, but it is at only 3 volts. If the OP had failed to reach his required 30 metres then I would have suggested he tried 3.7 volts (1 x LiPoly or 3 x NiMH rechargeables) or even 4.5 volts on the basis that there wasn't much to lose.

@Stephen: It's encouraging that you got to 30 metres, so you can continue experimenting for now and decide later if it's worthwhile to get a better transmitter to be more user-friendly (e.g. smaller antenna or better signal reliability, etc.).

You can only use the RFOUT / IN commands with your 14M2 and 18M2+ chips. The + is important and may be "missing" from "old" stock; The Program Editor will tell you if / when you try to program an old chip, but you might want to check before proceeding too far.

Yes, you must set the baud rate and polarity to be the same in transmitter and receiver programs (there are "special" versions of the parameters if you were changing the clock speed, e.g SETFREQ M8 would require T2400_8, etc.). N2400 is unlikely to give any better range than T2400, and probably less, or not at all without some other changes. The problem is the Automatic Gain Control (AGC) in the receiver: When the transmitter is switched off (as specified by the ISM regulations, or just to save some battery power) the receiver normally increases its amplification until it receives "noise" (random data). The PICaxe may think this is "real" data and produce spurious results (like the proverbial monkeys with typewriters). It may also miss the start of any "real" data, because the AGC cannot instantly readjust when the transmitter switches back on.

So, to use N2400 (or any "idle-off" signal) it's necessary to send a "Preamble", perhaps a $55 character and then a "Qualifier" that the receiver can look for to confirm it's an intended command. Alternatively, to comply with ISM requirements (and save some transmitter battery power) you could just switch off the transmitter when there's nothing to send. Untested, but something like:
Code:
symbol TXD = C.0            ; Transmitter pin
do
  for b1 = 0 to 15
    high TXD               ; Switch on transmitter
    pause 10               ; Wait for receiver to stabilise
    serout TXD , T2400 , ($55 , b1 )   ; Transmit a Qualifier and Data byte
    low TXD                 ; Switch off transmitter
    pause 500
  next b1
loop
Cheers, Alan.
 

old plumber

New Member
Hello again,
Stan, good to hear from you, we emailed some time ago re similar subject.
Thanks for your input. I will take you up on your offer and purchase some Dorji Tx units when convenient for you.
I will continue with what I have as it's ok to develop the project.
It's mainly the coding that I am slow at. Some people use short cuts and use little or no explanation.
I learn't much from your Silicon Chip articles.

Alan, thanks again for your time.
I looked at the rfout and rfin commands in the picaxe manual and example code on picaxe circuit creator site and I think I can work them into my project easier than serin and serout. As you said "they're designed for the job".
My PicAxe chips are indeed 14M2 and 18M2+ so I can use the rf commands.

I now need to rebuild my circuits and I'd like to have a go at writing the code then post to see what you think.
If that's ok with you?

Regards, Stephen
 

Bill.b

Senior Member
Hi Stephen

I have used the picaxe AXE213 encoder modules for reliable communications between picaxe. These encoders take of the preamble and CRC
resulting in reliable comms. You only need to send and receive serial data to the AXE213.
23828
this is the transmitter for my robot car (not used now as I changed to Bluetooth)

I have several of these decoders .
I see we are both from the Newcastle area, send me a private message if you would like one.

Regards Bill
 

old plumber

New Member
Hello Bill, thanks for your comments.
Seems to me I can achieve the same results with rfin and rfout commands available to the 14M2 and the 18M2+ chips, as per Alan's post #8.
I am going down that track for starters as I have all the components required.
Appreciate your offer.

I am rebuilding the circuits now and dreaming the code. Will post as soon as ready for any critique.

Regards, Stephen
 

AllyCat

Senior Member
Hi Stephen,

It's well worth reading the datasheet for the AXE213 / NKM2401 which gives quite a lot of useful background information.
Seems to me I can achieve the same results with rfin and rfout commands available to the 14M2 and the 18M2+ chips....
Well, yes and no. Certainly for the transmitter the RFOUT should give much the same functionality as the NKM2401 "for free". However, for the receiver, the issue of "multi-tasking" arises if you want to receive signals (RFIN) and control a servo at the same time. PICaxes (and most microcontrollers) don't have multiple "cores", so they can only rapidly switch between multiple tasks in the hope that "nobody notices". But some tasks are "blocking" in that they take complete control of the processor and others must wait.

I don't know if you plan to use a classic (model makers') servo, but there is a current thread (and there have been many previously) reporting that the servo (even though normally a reliable "background" task) suffers from "Jitter" when some other commands are being used. However, your OP (#5) indicated the intention to steer a jet of water which might need a more powerful "servo". At that extreme there is another current thread discussing the servo control of a "robot arm".

Therefore, you might need a two-processor receiver, a 14/18M2+ to RFIN the radio signal and a second processor (perhaps just an 08M2) to control the jet of water. So you may still have sufficient PICaxes for your project, but if you do need to buy another processor, then the NKM2401 can be quite a bargain (if you can find / buy one).

Cheers, Alan.
 

old plumber

New Member
Thanks again for your reply Alan.
Firstly, my final mechanics should consist of a somewhat light weight pan and tilt mechanism which would direct a small, say 6mm jet of water, via a flexible hose towards the errant birds. I have some quite powerful servos ex. an old speed boat which should do as I can build in some mechanical advantage. The jet would be turned on and off using a solenoid valve from a not too old washing machine. Possible 12V coil.

Attached are fritzing pics of the Tx & Rx Circuits using 14M2 picaxes and my code.
My code is written with bits borrowed from Picaxe Circuit Creator RF Radio Tx & Rx examples.
I established comms between Tx & Rx boards but it's not working as intended yet.

My code only operates the intended solenoid relay board as follows:-
1. As boards are powered on the relay immediately turns on.
2. When switch1 is pressed the relay turns off and stays off. Further button presses have no effect.
So I have comms but the code is faulty.

I don't know where best to look for Servo control over Tx & Rx
I'm sure I'm not the first to attempt this. Maybe I could adapt from an existing project?
Am I on the right track or should I change my approach?

Assistance appreciated,
Kind regards, Stephen
 

Attachments

lbenson

Senior Member
I don't know where best to look for Servo control over Tx & Rx
This program from along about 2009 receives serial input to control a pan and tilt camera:
Code:
' 08Srv_1D_151028 test servo
'  modify to enable changing of servoMin,Max
#picaxe 08m2

symbol panSpot = b13
symbol tiltSpot = b12
symbol activeServo = b11
symbol activeSpot = b10
symbol lastSpot = b9
symbol servoMax = b8
symbol servoMin = b7

symbol pInPin = c.1
symbol panServo = c.4
symbol tiltServo = c.2
symbol cServoMin = 75
symbol cServoMax = 225
symbol cServoCenter = 150
symbol tiltMin = 140
symbol eepServoMin = 0 ' address of servoMin in eeprom
symbol eepServoMax = 1 ' address of servoMax in eeprom

eeprom eepServoMin,(cServoMin,cServoMax)

pause 2000               ' wait 2 seconds
read eepServoMin,servoMin,servoMax
sertxd("08Srv_1D_151028: min, max: ",#servoMin," ",#servoMax,cr,lf)
pause 8000               ' wait 8 seconds
activeSpot = cServoCenter 
panSpot = activeSpot       ' center
tiltSpot = activeSpot      ' center
lastSpot = activeSpot - 1
'high 0          'set up for serout
ActiveServo = tiltServo    ' tilt servo is active
gosub servoOut
ActiveServo = panServo     ' pan servo is active
gosub servoOut

main:
  do
'    serin pInPin,N2400,b1
    serin pInPin,T2400,b1
'    serout 0,N2400,(b1, " ",  #b1, " ")
    select b1
     case "p"
      activeServo = panServo
      activeSpot = panSpot
      lastSpot = panSpot   ' make sure we move with new servo
     case "t"
      activeServo = tiltServo
      activeSpot = tiltSpot
      lastSpot = tiltSpot   ' make sure we move with new servo
     case "m"
      servoMin = servoMin - 5 min cServoMin
      write eepServoMin,servoMin
     case "n"
      servoMin = servoMin + 5 max cServoCenter
      write eepServoMin,servoMin
     case "x"
      servoMax = servoMax - 5 min cServoCenter
      write eepServoMax,servoMax
     case "y"
      servoMax = servoMax + 5 max cServoMax
      write eepServoMax,servoMax
           
     case "0"
      activeSpot = cServoCenter 
     case "1"
      dec activeSpot
     case "2"
      inc activeSpot
     case "3"
      activeSpot = activeSpot - 5
     case "4"
      activeSpot = activeSpot + 5
     case "5"
      activeSpot = activeSpot - 10
     case "6"
      activeSpot = activeSpot + 10
     case "7"
      activeSpot = servoMin
     case "8"
      activeSpot = servoMax
    endselect

    activeSpot = activeSpot max servoMax 
    activeSpot = activeSpot min servoMin 
    if activeServo = tiltServo then
      activeSpot = activeSpot min tiltMin
    endif
    if activeSpot <> lastspot then
'      serout 0,N2400,(#activeServo, " ",  #activeSpot)
      if activeServo = panServo then
        panSpot = activeSpot
      else
        tiltSpot = activeSpot
      endif
      gosub servoOut
      lastspot = activeSpot
'      pause 50
    endif
  loop

servoOut:  ' smoothly move from lastSpot
  b2 = activeSpot - lastSpot
  b3 = 1
  if activeSpot < lastSpot then
    b2 = lastSpot - activeSpot
    b3 = $FF   ' minus one
  endif
  sertxd("Servo: ",#activeServo," pos: ",#activeSpot, cr,lf)
'  serout 0,N2400,(#b2, " ", #b3, " ", #lastSpot, " ", #activeSpot,10,13)
  activeSpot = lastSpot
  for b4 = 1 to b2       ' move smoothly to new activeSpot
    activeSpot = activeSpot + b3
'  serout 0,N2400,(#b4, " ", #b3, " ", #b2, " ", #activeSpot,10,13)
      pulsout activeServo,activeSpot
      pause 20
      pulsout activeServo,activeSpot  ' twice seems to make it work
      pause 20
  next b4
  lastSpot = activeSpot
  return
The particular codes looked for are "p" (select pan servo), "t" (select tilt servo), and "0"-"8", signifying: 0-center; 1-reduce by one step; 2-increase by one step; 3-reduce by 5 steps; 4-increase by 5 steps; 5-reduce by 10 steps; 6-increase by 10 steps; 7-move to minimum; 8-move to maximum.

It should give you some idea of the possibilities. It does not slew to the selected position--it moves smoothly one step at a time. It's fairly quick in doing this, but may not give you the satisfaction of spraying the bird before it flies.

(Note--it generally works well, but there's an occasional glitch which might be the servos or might (more likely) be my code. If you find it, please let me know.)
 

Bill.b

Senior Member
Hi Stephen

This is the code for the TX and TX I used on my robot car. The receiver controls a Relay and a servo to pan the camera.
The tx uses a joystick to control the servo and buttons for the relay ON / OFF. The joystick input is a 10k pot.
The AXE213 fitted with TX and RX modules are available free if you would like a set.

code for the TX
Code:
'Transmitter for big bot
#picaxe 18m2
setfreq m8
symbol LeftT    = pinc.1    'Fast left turn press button input
symbol RightT    = pinc.0    'Fast Right turn press button input
symbol videoON    = pinc.7    'Video Camera ON press button input
symbol VideoOFF    = pinc.6    'Video Camera OFF press button input
symbol TxLED    = b.0        'Transmit LED output
symbol RFout2    = b.7        'Output to AXE213 TX
symbol VideoLED    = b.5        'Vedio ON LED output
symbol LeftXdata    = b2
symbol LeftYdata    = b3
symbol RightXdata    = b4
symbol RightYdata    = b5
symbol LeftX    = b.1
symbol LeftY    = b.2
symbol RightX    = b.3
symbol RightY    = b.4
symbol IRCode    = b0
symbol LoopCount    = b1
symbol Baud = N2400_8
Low VideoLED


main:
gosub ScanKeyboard
gosub analogin
goto main

ScanKeyboard:' Check input switched and trasfer to tx output if activated

    if LeftT = 1 then
        IRCode = 1
        high b.5
        gosub IRoutput
    endif
    if RightT = 1 then
        IRCode = 2
        low b.5
        gosub IRoutput
    endif
    if videoON = 1 then
        IRCode = 4
        high VideoLED
        gosub IRoutput
    endif
    if VideoOFF = 1 then
        IRCode = 8
        Low VideoLED
        gosub IRoutput
    endif
'    gosub IRoutput

    if LeftT=0 and RightT=0 and videoON=0 and VideoOFF=0 then
    IRcode =0
    endif
return

analogin:    'Read analogue values for Left and Right joysticks

readadc LeftX,LeftXdata
readadc LeftY,LeftYdata
readadc RightX,RightXdata
readadc RightY,RightYdata
RightXdata = 255-RightXdata
RightYdata = 255-RightYdata
LeftXdata = 255 - LeftXdata
'debug
gosub IRoutput
return

IRoutput:        ' send data to bot.  the first byte is "T" this is used by the bot to check transmition.
            ' T being the first byte to be received.
'debug
    high TxLED
    serout Rfout2,baud,("T",IRcode,LeftXdata,LeftYdata,RightXdata,RightYdata,"   ")     'The AXE 213 required 8 bytes before it will transmit data to bot
    'IRCode = 0
    low TxLED
    pause 450
    return

Code for RX - I have used pulse control of the servo as there is a problem with serial control and servo control working together.
Code:
'picaxe 08m2
'W brown  2nd Aug 2013
'Progam to control the video camera on the big bot.
'Controls the camera ON/OFF and pan.
'Inputs
'
'    C.4  = Serial input from remote.
'Outputs
'    c.1  = Pan Servo
'    c.2  = Relay - Camera power.
'        -  Camera ON/OFF
'**************************************************

#picaxe 08m2
setfreq m8
symbol IRinput    = b0
symbol Servocount    = b1
symbol relaylatch    = b2
symbol relay    = c.2
symbol counter1    = w3
symbol counter2    = w4
symbol IRData    = c.4


Symbol KEY_VideoON      = 1
Symbol KEY_VideoOFF    = 2


for Servocount = 1 to 20
    pulsout c.1,280
    pause 20
next Servocount
counter1 = 280


main:
do
    serin IRData,N2400_8,b14,IRinput,b10,b11,b12,b13
    pause 10
    if b14 <> 84 then main
    counter1 = b12
    counter1 = counter1 + 160
    for Servocount = 1 to 20
        pulsout c.1,counter1
        pause 20
    next Servocount

    if IRinput = KEY_VideoON then
        high relay
        IRinput = 0
    endif
    if IRinput = KEY_VideoOFF then
        low relay
        IRinput = 0
    endif

    pause 50
    IRinput = 0
loop
Receiver section of my robot.

23839

regards Bill
 
Last edited:

AllyCat

Senior Member
Hi Stephen,
I don't know where best to look for Servo control over Tx & Rx
....
Am I on the right track or should I change my approach?
As far as the "transmission" part of sending Servo control over TX & RX is concerned, you can simply set some of the RFOUT parameters (currently b0 to b7 in your code) to the value of the pulses that the servo needs to receive (assuming "standard" servos which require pulse values nominally between 75 and 225).

The main problem with your present program code is that it only transmits when the button is actually pressed. That's good to avoid "polluting the airwaves", but you have to consider what the receiver does when it doesn't receive any data packets (the basic answer is "nothing", it just keeps waiting). Note also that the ONLY "message" you are transmitting at the moment is eight zeros (the zero that you set and the others are the default values when the program starts).

One solution is to define and transmit separate "Turn On" and "Turn Off" codes, but for now, perhaps simply send one packet each second. Something like:
Code:
do
   b0 = Switch1
;  Other stuff as required
   RFOUT B.1 , (b0 , b1 , b2 , b3 , b4 , b5 ,b6 , b7 )
   PAUSE 950       ; milliseonds
loop
BTW it's easier if you post program code from the Editor directly between [code ] [/code ] tags. Then we can just edit any errors, and when the program gets more complicated, we can try it in the Simulator.

Cheers, Alan.
 

erco

Senior Member
FYI, some useful info on those cheap 433 modules at https://www.romanblack.com/RF/cheapRFmodules.htm

I buy them on ebay china for a buck a a pair. I throw the receivers away, they are junk. much better superhet receivers are available. Then I test the transmitters and half are junk. False economy!
 
Last edited:

old plumber

New Member
Oh boy, you fellows are so generous!
Give me some time to absorb all you have sent.

Ibenson, thanks for your reply and code.
I like the idea of slow, smooth movement as it may be less likely to alert the birds.
I will study your code.

Alan, thanks for the instruction,
I will give it a go with your example.
I think I missed your point in your previous post. Am I correct in understanding that the picaxe is a bloke chip and can only do one thing at a time?
I read about 'rfin' being a blocking command and nothing happens while it is waiting.
Hence you suggesting I might use two picaxes in the receiver section.
Bill has solved this issue in his offer of AXE213's

Bill,
Thanks for your time and your detailed reply.
The diagram is almost exactly what I need to achieve plus with a second Tilt Servo if that is possible.
I understand the schematic and could reproduce it with your permission. I will need a hand understanding the code, but I will study it first.

I would like to take up your offer of the AXE213s but would like to pay for them. Two pairs if ok.
You mentioned 'private message', what way have you in mind?

Kind regards to all, Stephen
 

old plumber

New Member
Hello erco,
I purchased two pairs from a long standing local supplier some time ago. They were somewhat dearer but I can return them if faulty. They also speak good Australian !
 

Bill.b

Senior Member
Hi Stephen

This is my current version of my bot with pan and tilt control of the camera.
The comms are Blutooth, so the code would not be suitable for you.
You can send a private message by selecting the envalope at the top of the page.
This is for sending address or email address which you do not want all to know.

23840

Regards Bill
 

old plumber

New Member
Hello, I'm back to update you all on progress so far.
After much consternation I had to reevaluate my Bird Dissuader Project. Firstly the 433MHz system seemed to have too many prohibitive factors i.e. power/range, interference. Secondly, I had much difficulty coding the RC side of Picaxe. I think sanility will overtake me before I come to grips with it. So I bought a TGY-i6 RC system with extra Rx units for about 50 little AU dollars.
With this I can control six servos or six switches or any combination of the six channels.
Then I found two sites :-
- http://www.sailservo.co.uk/picaxe/picaxe.html
-http://runamok.tech/RunAmok/flysky_i6.html
which gave, very clear and logical explanations and examples of code to control robots or sailing boats i.e. servos and switches with the above RC system.
From them I have wired a Picaxe circuit for a dual Rx Switch (pic attached), and adapted the attached .bas code.
AND IT WORKS !!!
Now I can start fabricating the Pan, Tilt & Valve mechanisms before the indian minah birds eat all the chook food

I will gladly accept advice to streamline my code.

Thanks again for all your generosity,
Stephen

Capture.JPG
;Code File Name - SAS SailServo Ch5Ch6 Fixed Input Switch.bas
;Adapted from SailServo Tutorial Chapter 13 by Stephen Somogyi 20200612
;This code takes input from 2.4GHz Tx Chanels 5 & 6 into C.3 & C.4 respectively.
;Outputs from C.1 & C.2 operate Red & Green LEDs (later Switches or Solenoids)
;Tested - Results Positive

#no_data

main:
pulsin C.3, 0, w1 'WHITE wire - State 1 = low to high pulse starts timing
'*SAS changed to "0" as transistor changes polarity.*
pulsin c.4, 0, w2 'YELLOW wire -

if w1 > 150 then
gosub redLed 'if w1 is more than 150 then RED LED ON
else
gosub noRedLed 'if w1 is less than 150 then RED LED OFF
endif

if w2 > 150 then
gosub greenLed 'if w2 is more than 150 then GREEN LED ON
else
gosub noGreenLed 'if w2 less than 150 then GREEN LED OFF
endif
goto main

redLed:
high C.1 'switch ON leg 6 for RED LED
return

noRedLed:
low c.1 'switch OFF RED LED
return

greenLed:
high C.2 'switch ON leg 5 switch for GREEN LED
return

noGreenLed:
low C.2 'switch GREEN LED OFF
return
 

Attachments

westaust55

Moderator
David Lincoln originally had a website from which all the code in the book and a lot of errata (I had provided a lot of feedback to the Vol 1 errata just as the book was released) was available to save time typing.

Lincsoft website has gone but the
wayback Website has archives

For volume 2 goto:

I did not locate the errata pages but they may well also be available.
 

old plumber

New Member
Hello westaust55, thanks for your reply. I have David Lincoln's two books and have worked through them for mechatronics ideas but have never seen any errata. I was able to fix some things that didn't work but some l couldn't.
My biggest problem is linking the code snippets together. Also I was distracted by arduino and micromite, should have stuck with the one system!
Anyhow I've had some success with the above so l will continue down this path.
The Sailservo tutorial suggested using the oscilloscope from picaxe so l ordered one to help analyse Tx waveforms. You will probably smile at it's simplicity but the tutor seemed to like it. PLUS I could afford it! I will probably have some questions re that as well.
Kind regards, Stephen
 

lbenson

Senior Member
The Sailservo tutorial suggested using the oscilloscope from picaxe
I don't use that DPScopeSE very often, but did today. It's most helpful in seeing timing issues--in my case today it showed that a 250 microsecond-per-step ramp in A.C. "cycle slicing" code within a zero-crossing triggered 8.33ms window (N. America 60Hz cycle--120 half-cycles per second) was working for a "soft start" proof-of-concept idea I had:
AC Cycle Slicing.jpg
Congratulations on your working project.
 

old plumber

New Member
Thanks Ibenson. I still need to study the code you sent previously , but l like the idea of interrupts for smoother flow.
Glad you approve of my scope purchase!
Stephen
 
Top