HobbyKing.com New Products Flash Sale
Reply
Thread Tools
Old Mar 03, 2013, 03:12 AM
Registered User
Scottish Borders
Joined Mar 2006
572 Posts
Pete,
Thank you for the link, I had no idea that anyone would ever consider using solar panels to power a boat. Small parochial mind, we have very little knowledge of Sun Powered anything in these parts.

Last year the French did cross the start line into the North Atlantic.

The transit has been done already, free from the troubles of wind and wave.

Dave

http://www.microtransat.org/tracking-2012.php

http://www.popsci.com/technology/art...rossing-robots
orraman is offline Find More Posts by orraman
Reply With Quote
Sign up now
to remove ads between posts
Old Mar 03, 2013, 09:40 AM
---o-O-o---
blutoh's Avatar
United States, NJ, Livingston
Joined Mar 2012
1,600 Posts
Quote:
Originally Posted by orraman View Post
The transit has been done already, free from the troubles of wind and wave.
True, but it would be nice to see it done on the water and without a multimillion dollar budget

Pete
blutoh is offline Find More Posts by blutoh
Reply With Quote
Old Mar 03, 2013, 11:48 AM
Registered User
Scottish Borders
Joined Mar 2006
572 Posts
Pete,
The west to east crossing is open to all, you fancy a shot?
Too many of the planks have splintered on my 50 year Marblehead.

Dave

Section D.2: West to East competition route
The start point is along the line of longitude at 51 degrees and 30 minutes West, between 42 and 48 degrees North.
orraman is offline Find More Posts by orraman
Reply With Quote
Old Mar 03, 2013, 11:58 AM
---o-O-o---
blutoh's Avatar
United States, NJ, Livingston
Joined Mar 2012
1,600 Posts
Quote:
Originally Posted by orraman View Post
Pete,
The west to east crossing is open to all, you fancy a shot?
No Dave, too much on my plate already .

Pete
blutoh is offline Find More Posts by blutoh
Reply With Quote
Old Mar 03, 2013, 01:24 PM
Registered User
Scottish Borders
Joined Mar 2006
572 Posts
Another First Class site.

Serial driven unipolar Half Step stepper motor driver by DMT195.

Where 2 motor coils are energised at the same time the resultant magnetic field is between the poles.

Wave Step is where each coil is energised individually and in succession, easiest to test for proper sequence, least power.
Full Step is where a pair of adjacent coils are energised giving maximum power.
Half Step is where one coil is energised and on the following step the next coil is also energised and subsequent steps follow this pattern.
Half Step is shown well in the Simulator.

A stepper nominally of 200 steps will need 400 steps per rev in Half Step, greater resolution and sometimes used to overcome difficult driving where the step rate matches the natural resonance of the motor.

I have copied the program and made some small changes so that it will run in the Simulator and see no reason why the incoming serial step and direction should not come from another Picaxe. The first byte of the 3 incoming serial data bytes must match the qualifier byte or the message will be ignored and in this way numerous motor controllers could be in a serial net.

Dave

EDIT
Just copied from this page and tested in the Simulator.

http://dmt195.wordpress.com/2008/03/...or-controller/

Code:
'Serial driven stepper motor by DMT195  
'Working in simulator; NOTEs = extras for Homebrew Hacks
'NOTE the Simulator will stop and ask for serial-in data
'NOTE data to be like this ~~ 138,11,222 ~~ 
 symbol posrotor=b0  
 symbol numturns=b2  
 symbol speeddir=b7  
 symbol direc=b8  
 symbol pulsegap=b3  
 symbol counter=b4  
 symbol modrotor=b1  
' symbol outbyte=b5.......NOTE outbyte now a reserved word replaced with~~  
 symbol oot=b5
 
let dirsb=%11111111 '.....NOTE inserted for Simulator operation    

 posrotor = 1 'set starting position  

 start:    'main sequence - wait for command then move the motor  
 
  numturns=0   'sets a default number of turns  
  high 7    'reset ready flag  
  serin 0,T2400,(138),numturns,speeddir 'get serial data  
  gosub getspeed   'get the direction and speed  
  gosub move       'perform number of steps  
 goto start  

 getspeed:    
  if speeddir > 128 then  'find direction, store in direc(1 is +ve, 0 is -ve)  
   direc=1  
  else  
   direc=0 
  endif   
  speeddir=speeddir//128 
  'gets the speed 0-127 negative, 128-255 positive (higher =faster)  
  pulsegap=264-2*speeddir  
 return 
  
 move:    
  for counter=1 to numturns  
   pause pulsegap      'wait before moving again (set by speed)  
  if direc=1 then  
   posrotor=posrotor+1 'increase/decrease the step by one  
  else 
   posrotor=posrotor-1 
  endif  
    gosub moverotor  'set the rotor position for this step  
  next counter  
 return 

 moverotor:  
  modrotor=posrotor//8    'find out where the rotor arm should be (1 of 8 positions)  
  lookup modrotor,(1,3,2,6,4,12,8,9),oot  

  'in binary this is (%00000001,%00000011,%00000010,%00000110,%00000100,%00001100,%00001000,%00001001)  
  'looks up the step from the sequence and applies it to the output pins  

  pins=oot

 return
orraman is offline Find More Posts by orraman
Last edited by orraman; Mar 03, 2013 at 03:39 PM. Reason: Checked in Simulator d
Reply With Quote
Old Mar 04, 2013, 10:15 AM
Registered User
Scottish Borders
Joined Mar 2006
572 Posts
Bipolar Picaxe Serial Driver

The advantage for unipolar motors is easy driving with 4 transistors or FETs directly from 4 outputs on a micro.
The ULN2003 Darlington chip can handle 500ma and there is a nice schematic in the Picaxe Manual3 pages 15 and 16 that allows control with only 2 outputs.

For the same size of motor the bipolar has about 1.4 times the power of the unipolar.
However they require current reversal in their coils and this is usually done with a Full-Bridge motor driver.

The L298N is such a driver, can handle up to 2A and is currently available on an all singing all dancing PCB for less than 3.
An on board voltage regulator can supply the 5V for the micro and access to the Enable inputs of the L298N allows pulse width modulation, PWM for 1 stepper or 2 brushed motors with speed and direction.

The current in a coil does not jump to a high value the instant a new pulse arrives, it rises in relationship to the resistance, R and inductance, L, (q.v.).
Time to reach 63% of rated current (t) is t=L/R.

In steppers at low pulse rates and at their rated voltage the current will have plenty of time to reach maximum before the next pulse arrives.
At higher speeds higher voltage can push current into the winding and one way to regulate this is to use PWM which can also be used to halve the power to protect the motor from overheating when stationary.

Picaxe have PWM functions and the Editor has a PWM Wizard to help get the best out of it.

This Bipolar Picaxe Serial Driver program is another from David Taylor and again I have made similar changes to get it to run in the Simulator.

Dave


Bipolar Picaxe Serial Driver

Code:
'working in Simulator
'from web-dmt195 today
'
'to run a stepper driver chip, L298N
'Direction 1A 2A 3A 4A 
'N 1 0 0 0 
'NE 1 0 1 0 
'E 0 0 1 0 
'SE 0 1 1 0 
'S 0 1 0 0 
'SW 0 1 0 1 
'W 0 0 0 1 
'NW 1 0 0 1 



'and the program as follows. Note that this program is designed to wait until 
'it detects a serial input on input 0 (pin 17) in the form of three bytes: 
'The first is a qualifier  85 uniquely identifies this stepper motor  the 
'second is the number of steps  0-255, and the third is the speed  0-127 is 
'backwards, 128-255 is forwards.


'Serial driven stepper motor by DMT195

symbol posrotor=b0
symbol numturns=b2
symbol speeddir=b7
symbol direc=b8
symbol pulsegap=b3
symbol counter=b4
symbol modrotor=b1
symbol oot=b5
 
let dirsb = %11111111
posrotor = 1 'set starting position

start:    'main sequence - wait for command then move the motor
 numturns=0   'sets a default number of turns
 high 7    'reset ready flag
 serin 0,T2400,(85),numturns,speeddir 'get serial data
 gosub getspeed   'get the direction and speed
 gosub move       'perform number of steps
goto start 

getspeed:
 if speeddir >128 then  'find direction and store in direc (1 is +ve, 0 is -ve)
  direc=1
 else
  direc=0
 endif
 speeddir=speeddir//128
 'gets the speed 0-127 negative, 128-255 positive (higher =faster)
 pulsegap=264-2*speeddir
return

move:
 for counter=1 to numturns
  pause pulsegap      'wait before moving again (set by speed)
 if direc=1 then
  posrotor=posrotor+1 'increase/decrease the step by one
 else
  posrotor=posrotor-1
 endif
   gosub moverotor  'set the rotor position for this step
 next counter
return

moverotor:
 modrotor=posrotor//8    'find out where the rotor arm should be (1 of 8 positions)
 lookup modrotor, (0x08,0x0A,0x02,0x06,0x04,0x05,0x01,0x09), oot
 '(%00001000,%00001010,%00000010,%00000110,%00000100,%00000101,%00000001,%00001001) is (0x08,0x0A,0x02,0x06,0x04,0x05,0x01,0x09) in hex
 'looks up the step from the sequence and applies it to the output pins
 pins=oot
return
orraman is offline Find More Posts by orraman
Reply With Quote
Old Mar 05, 2013, 08:11 AM
Registered User
Deckie's Avatar
Australia, WA, Garden Island
Joined Nov 2010
464 Posts
Quote:
Originally Posted by orraman View Post
There are more interesting links on this site than I have seen before.

But do look at the History link at the bottom.
No pretentions, humorous, informative.

Dave




Robin Lovelock,

Our autopilot picaxe software has a feedback loop lasting about 6 seconds:
1) use SERIN to read data from the GPS including lat/lon, direction, speed.
2) read direction from wind direction sensor and convert to absolute direction.
3) test if lat/lon in a waypoint box, or other values, and change the destination lat/lon if needed.
4) calculate the target heading from GPS lat/lon to the destination lat/lon.
5) modify this target heading if it means sailing too close to the wind.
6) calculate the error in heading between target heading and real GPS heading.
7) move the rudder servo to steer the boat.
go back to step 1 above.


Picaxe Guided Trans-Atlantic Boat
http://www.gpss.force9.co.uk/autop.htm

History
http://www.youtube.com/watch?v=R-LHy...ture=endscreen
Seems like it works quite well, i'm very curious as to the particular Make and Model of the wind direction sensor they're using.

EDIT:
Found! it's an Ametes wind direction sensor.

http://www.gpss.force9.co.uk/ametes.htm

I wonder how much smaller it could be made, could be the wind direction sensor needed for accurate Dynamic Positioning. That, a gyro and one of the cheaper integrated accelerometer/compass modules and you'd be in business. Seems like that sensor package could go together for just under $100, less if you make your own housing.
Deckie is offline Find More Posts by Deckie
Last edited by Deckie; Mar 05, 2013 at 08:18 AM.
Reply With Quote
Old Mar 05, 2013, 12:54 PM
Registered User
Scottish Borders
Joined Mar 2006
572 Posts
Greetings Deckie

I am pleased that you brought this up (and pleased you found your answer) as I am considering resurrecting a much neglected vintage Marblehead. The only water available to me is the estuary of a tidal river with an unfavourable prevailing wind and I am seeking information on a reliable failsafe.

Of the links provided I can only see the Melexis as being viable for me with regard to availability and cost.

I am seeking advice or links from any quarter for the yacht which is fully planked with the deck rounding down to the sides with a radius of about 2" and for the failsafe. Help.

Dave
orraman is offline Find More Posts by orraman
Last edited by orraman; Mar 05, 2013 at 02:51 PM. Reason: dd
Reply With Quote
Old Mar 06, 2013, 12:11 PM
Registered User
Scottish Borders
Joined Mar 2006
572 Posts
Vintage Model Yacht Group

I have managed to get in touch with the Vintage Model Yacht Group and have received information and offered advice: delighted.

There is a great interest in making boat sounds. That I have tinnitus and hyperacusis (faulty bolt gun) has nothing on being short of having what it takes so I can't help.

However the chap in the second link has gone commercial and is using a Picaxe 20X2 at 64 MHz and explains why on youtube. Quite impressive, and good business practice, it's impossible to reverse engineer a Picaxe.

Dave

Vintage Model Yacht Group
http://www.vmyg.org.uk



Alan Bond's New marine sound(take2)
Alan Bond's NEW Marine Engine Sound Unit (take 2) (2 min 20 sec)


Picaxe steam sound using shaped chuff ~~ Trains
Picaxe steam sound using shaped chuff (0 min 46 sec)
orraman is offline Find More Posts by orraman
Reply With Quote
Old Mar 06, 2013, 02:13 PM
---o-O-o---
blutoh's Avatar
United States, NJ, Livingston
Joined Mar 2012
1,600 Posts
Hi Dave,

Very interesting. They have taken the approach of synthetically generating the sound insead of using recorded sound files, which is the way most model railroad sound sytems work.

Pete
blutoh is offline Find More Posts by blutoh
Reply With Quote
Old Mar 06, 2013, 04:09 PM
Registered User
Scottish Borders
Joined Mar 2006
572 Posts
Pete,

Here is Alan Bond's Marine steam version which has two 3.5mm Picaxe download sockets and two 8pin chips.
Again there is more information on the youtube site and eventually to his page on his local model boat club site.

Dave


Alan Bond's Marine Engine Sound Unit (steam version) (0 min 40 sec)


http://srcmbc.org.uk/ht_afb_sound-un...ine-engine.php
orraman is offline Find More Posts by orraman
Reply With Quote
Old Mar 09, 2013, 05:01 AM
Registered User
Scottish Borders
Joined Mar 2006
572 Posts
On another Forum Jankraak (Great website) requested a program and schematic for a servo extender.
I posted a simple Simulator program to test the water and thought it appropriate to copy it here as it is relevant to a Picaxe thread.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This simplistic Simulator program could be copied and pasted into the free Picaxe Programming Editor. Select Picaxe 08M2.
In the Simulator click the chevrons lower right in the main window, select Word variables, enter numbers between 1 and 255 in C.1 and C.2 for the ADCs.
Enter numbers between 100 and 200 in Generic, Single step or Run. Change numbers.

Code:
'Simulator only
'Simple winch with endpoint limits for Simulator
'all after (') is comment and ignored by compiler
'rceiver pulse on GPIO3,pin4
'pot1 on GPIO1,pin6: pot2 on GPIO2,pin5
'winch on GPIO4,pin3

#picaxe 08M2

symbol pulsinn=w1 'word variable named pulsinn
symbol pot1=w2    'trimpot 
symbol lowl=w3  
symbol pot2=w4  
symbol inter=w5   'inermediate number 
symbol hilim=w6  
symbol winch=w7
 

 
Start:
  pulsin 3,1,pulsinn
  if pulsinn<100 or pulsinn>200 then start  
 
main: 
  pulsin 3,1,pulsinn
  readadc 1,pot1         '}pots reads 0 to 255 so reduce
    lowl=pot1/10+100     '}numbers to reasonable percentage
  readadc 2,pot2         '}of servo movement  
    inter=pot2/10        '}arbitary 10%
    hilim=200-inter
    
  if pulsinn<150 then              'assumed centre position
    let winch=pulsinn min lowl     'set lower limit
  else 
    let winch=pulsinn max hilim    'set upper limit
  endif
  
  pulsout 4,winch
  goto main

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~

Another post to show how it should be done. ~~~~~

For anyone interested in a fully annotated comprehensive ready made Servo Extender and Failsafe visit the Picaxe Forum.
Schematic and PCB layout provided.

This program was written for the obsolete 8pin Picaxe 08m and uses 253 out of the 256 bytes then available.

The current 08M2 has an extra IO, many more functions, 8 times the memory, 4 times the speed, costs the same and will run this program using 267 out of a total of 2048 bytes.

Dave

Servo Range Extender and Failsafe by Kevin Goom
User Projects - Miscellaneous
http://www.picaxeforum.co.uk/showthr...highlight=goom


Please Note
The simple Simulator program has had the port assignments changed to fit a spare Picaxe 08 Protoboard that only needed a second trimpot.
Testing with Futaba RC showed 1 non fatal boob, corrected and working using 1 standard servo.
orraman is offline Find More Posts by orraman
Last edited by orraman; Mar 11, 2013 at 04:31 PM. Reason: Dissleccik Dave And the Simulator
Reply With Quote
Old Mar 11, 2013, 04:38 PM
Registered User
Scottish Borders
Joined Mar 2006
572 Posts
There is a limitation on the active ADCs in the Simulator.
When in the 08M2 mode only ADC1 and ADC2 can be seen as active at the same time and ADC4 has to be seen separately.

My much used 08 Protoboard was set up using the pins differently so after it was working on the Futaba radio I copied the working program into the last post but it did not show the variable numbers properly.

Just in case anyone wants to try the Simulator I have changed it back to the Simulator version which should work quite happily in real RC.

Dave

Update, copied back into the Editor and Simulating properly.
orraman is offline Find More Posts by orraman
Last edited by orraman; Mar 11, 2013 at 04:45 PM. Reason: Update
Reply With Quote
Old Mar 14, 2013, 03:19 PM
Registered User
Scottish Borders
Joined Mar 2006
572 Posts
A light dependant resistor hooked up to a Picaxe moving a servo makes a nice demonstration that I have used for years.
These few lines of code with a Picaxe will cause a servo to accurately track a varying DC voltage.

Code:
Start:
   readadc 2,b2
   b4 = b2 * 10 / 17 + 75 
   pulsout 1,b4
   pause 18
   goto start
The readadc 2,b2 instruction reads the value on GPIO2,pin5 and returns a value between 0 and 255 which is placed in the byte variable b2.
The standard servo has a nominal range from 1000us, micro seconds, to 2000us but most servos will respond to values from 750us to 2200us before they hit the physical end stops within the servo.

Picaxe Servo and Pulsout instructions work in units of 10us so the nominal range is from 100 to 200. Picaxe has no advanced maths with fractions so to find 0.6 of a number we multiply by 10 and divide by 17 discarding any remainder.

ADC max is 255 so multiplying by 10 dividing by 17 gives 150 and adding 75 gives a pulsout range from 75 up to 225 to the servo.

If longer programs are being written it makes sense to use names associated with functions.


Code:
' Picaxe 08M2 to read ADC to control a servo
symbol potb2 = b2 '.......assign names to variables which can change.
symbol maths = b4 
symbol GPIO2 = 2  '......assign names to constants which do not change
symbol GPIO1 = 1 
symbol rc_frame = 18

Start:
   readadc GPIO2,potb2
   maths = potb2 * 10 / 17 + 75
   pulsout GPIO1,maths
   pause rc_frame
   goto start

ADC input.
Potentiometers for manual control input or providing positional information normally require the outermost pins to go to the micro's +V and to the -V and the centre contact to an ADC pin on the micro.

Light Dependant Resistors, LDRs are usually used with a 10k series resistor to ground to form a potential divider and used as above.
10k is a compromise, much more than that and the capacitor at the front end of the ADC will take a long time to stabilise, much less, and more current will flow which can upset the readings by self heating.

As before, download the free Picaxe Programming Editor select 08M2 copy in the program click Simulator click the chevrons, low right, change the numbers in C.2.

Dave


Try Section 3

The PICAXE manual is divided into three separate downloads:
Section 1 - Getting Started
Section 2 - BASIC Commands
Section 3 - Microcontroller interfacing circuits
This first section provides general information for getting started with the PICAXE system. No prior understanding of microcontrollers is required, as a series of simple tutorials introduce the main features of the PICAXE system.

http://www.picaxe.com/Getting-Started/PICAXE-Manuals/
orraman is offline Find More Posts by orraman
Last edited by orraman; Mar 15, 2013 at 05:44 PM. Reason: dd
Reply With Quote
Old Mar 16, 2013, 09:50 AM
Registered User
Scottish Borders
Joined Mar 2006
572 Posts
Chap over on another forum is seeking a 12F675 microcontroller Free Flight Timer and kindly offers payment provided that it is not Picaxe and Acetronics is obliging without payment. So the moral question is

Should I do in Picaxe Basic and use the built in

Wizard >> Convert Basic to Assembler << which creates HEX as needed for use with their Pic Programmer BAS800

However it seems a worthy endeavour and there is the suggestion that such a device could be sold???

So another try in the Simulator, this time move the Serial Output Buffer down and out of the way to see the Memory, click the chevrons, and click Stop, RST, the switch GPIO3 on the chip outline for a new timing then run. Later, GPIO3 to run with new timing.

Dave

Code:
'Free Flight Timer Requirements
'1. When switched on, Timer is set to open throttle position (default)
'2. Engine is started, short button press starts timer, LED lights timer is armed.
'3. Time elaps, engine is cut, throttle stays low until switched off.
'Response
'Switch1 on GPIO3,pin4 Start Timed engine run and also on Switch1
'Switch1 hold down while switching ON to record new Time
'Steady LED = Timer is running
'1 second flash when new time is being recorded
#Picaxe 08M2  ' delete the 2 in this declaration if using 08M
eeprom 0,(15) '              pre-loading Time elapse into non-volatile memory

  servo 1,200 '               servo to high, initiating servo command
start:
  if pin3=1 then main '     Switch for new Time at Switch/ON only
  
start2:   
  servopos 1,200 '          Hi throttle, (default)
  pause 22 '                  wait for GO and time for servo RC frame
  if pin3=0 then start2 '   Initiate Time at Hi throttle
  
  high 2 '                  Timer running,    Steady LED during Hi 
  read 0,b0 '                 Get Time, in seconds from eeprom
  for b2=1 to b0 '          Count off the seconds
  wait 1 '                     1 second
  next b2 '                    Inc counter
  low 2 '                       Time finished LED extinguished
Fin:  
  servopos 1,100 '          Low throttle held till switch is OFF
  pause 100 '                 Servopos works in background,needs time
  goto Fin '                    Stay Low till switched off
  
Main:  
  servopos 1,100 '               Indicates Changing Time
  high 2
  pause 500 '                 Half second ndicator
  low 2
  pause 500 '                 Second half second             
  b2=b2+1 '                   Added to b2
  if pin3=1 then main'        Switch to end new Time
  write 0,b2 '                  Replace old Time in eeprom
  low 1 '                     
  goto start '             End of new timing. Switch OFF
Please note:
This code is a replacement.

http://www.techsupplies.co.uk/BAS800
orraman is offline Find More Posts by orraman
Last edited by orraman; Mar 25, 2013 at 03:06 PM. Reason: Translated from a Pic 12F675 version.
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Help, S.O.S., ..._ _ _... (and introduction) sajosa Electric Plane Talk 15 Feb 28, 2013 02:00 AM
Discussion How to wire an ESC to picaxe. keffa12 DIY Electronics 9 Apr 02, 2011 10:44 AM
Brushless Motors -- An Introduction... rc_ron Power Systems 1 Aug 06, 2004 12:18 PM
Suggest an introduction ducted jet ARF? bwaltz Electric Ducted Fan Jet Talk 2 Aug 23, 2002 07:50 PM