|
|
|
|
Scottish Borders
Joined Mar 2006
558 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 |
|
|
|
|
|
|
|
|
Scottish Borders
Joined Mar 2006
558 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
|
|
|
||
|
|
Quote:
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. |
|
|
|
|||||
|
Scottish Borders
Joined Mar 2006
558 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)
Picaxe steam sound using shaped chuff ~~ Trains
|
||||
|
|||||
|
|
|||
|
Scottish Borders
Joined Mar 2006
558 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
http://srcmbc.org.uk/ht_afb_sound-un...ine-engine.php |
||
|
|||
|
|
|
|
Scottish Borders
Joined Mar 2006
558 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. |
|
|
|
|
Scottish Borders
Joined Mar 2006
558 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 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/ |
|
|
|
|
Scottish Borders
Joined Mar 2006
558 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 This code is a replacement. http://www.techsupplies.co.uk/BAS800 |
|
| Thread Tools | |
Similar Threads
|
||||
| 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 |