Beginner in spin in need of help! (read inside)
maggie
Posts: 11
i'm a student working on an ROV for a national competition and i've been singled out form my team to be the one to code the micro controller for the control system(no one else wanted to do it). i learned basic without difficulty over the past few months but now i need to learn spin. the overall task i need to complete is to make a controller talk with the stamp and then turn on and off motors ect.
i've decided to use a wii classic controller, ive identified the scl ground volt and sda leads and have been using the wii classic files from the object exchange ( http://obex.parallax.com/objects/470/ )
the thing is, i have no idea from here what to do. i was going to try and make some sort of test where clicking the buttons for now just makes something show up in the serial terminal but i also have limited knowledge on how that would work. (extent of my knowledge http://letsmakerobots.com/node/23884 ) and when i try adding to the program what i believe will make it debug i get error messages, i wouldn't be surprised if i'm doing it completely wrong. would i want to make a separate object for this or just add it into existing ones? also where would be the correct place in the existing chain of objects to reference it?
im very confused about how this lenguage works in general and have only been able to make it do simple tasks like make an led blink so far. so any advice at all or helpful websites would be very much appreciated.
thanks, maggie
ADDITION: im using a discontinued propeller stamp with only 15 programmable pins
i've decided to use a wii classic controller, ive identified the scl ground volt and sda leads and have been using the wii classic files from the object exchange ( http://obex.parallax.com/objects/470/ )
the thing is, i have no idea from here what to do. i was going to try and make some sort of test where clicking the buttons for now just makes something show up in the serial terminal but i also have limited knowledge on how that would work. (extent of my knowledge http://letsmakerobots.com/node/23884 ) and when i try adding to the program what i believe will make it debug i get error messages, i wouldn't be surprised if i'm doing it completely wrong. would i want to make a separate object for this or just add it into existing ones? also where would be the correct place in the existing chain of objects to reference it?
im very confused about how this lenguage works in general and have only been able to make it do simple tasks like make an led blink so far. so any advice at all or helpful websites would be very much appreciated.
thanks, maggie
ADDITION: im using a discontinued propeller stamp with only 15 programmable pins
Comments
welcome to the propeller-forum!
The members in this forum are really friendly and patient even with the
most basic questions. I often think the propeller-chip is a microcontroller
that is attractive to people that are very open-minded and therefore patient.
If you look through the threads of this forum you will find basic questions
and high advanced questions and threads. So this is a place for everyone.
From beginners learning how to code for the first time up to assembler-tweaking-freakin-freaks
doing things that make the brains of other assembler-tweaking-freaks SPIN in twisted-circles ;-)
Parallax and the members of this forum always like to improve the
"feel-at-home-factor" as much as possible.
You wil NEVER get a "RTFM" (read that f... manual) as an answer.
You will get good will and direct help or a detailed hints WHERE in the manual more detailed information can be found.
You sould NEVER change any code in ready to use objects. This would create derivates of the object with maybe unexpected behaviour.
Your own code uses the objects as basic blocks with which you build more complex functions.
One point to start learning SPIN is the PE Kit Lab
http://forums.parallax.com/showthread.php/89958-Propeller-Education-Kit-Labs-Tools-and-Applications
How would you describe your programming-skill-level?
Just a raw estimation:
A) bloody beginner
several weeks and a few dozen lines of code that you have written yourself (in basic)
C) quite experienced in basic but new to SPIN
D) andvanced programmer in another language. (which one?)
The further advice depends highly on your understanding.
Same thing with electronics.
A) bloody beginner
I know Ohms law but not much more
C) quite experienced. I know what a diode, transistor etc is and how they work
D) give me any old TV or radio and I will repair the electronic
So please give a more detailed description of the control-functions you want to write a programm for.
keep the questions coming
best regards
Stefan
In archive files (zip files from OBEX and other places), there is often a "_README_.txt" file that shows which object is the "top" object. In your example,l lthe object "TestClassic" is the top object (the one you should load into the Propeller).
If you connect your classic controller to pins 28 and 29, you should be able to see the output from the controller in the terminal window (using "Propeller Terminal Window.exe").
Stefan asks some good questions and give lots of good advice. I do repectfully disagree with this point.
I'd change the "NEVER" (always a dangerous word IMO) to "whenever it's convenient". (But, it's not convenient in this case.)
I do suggest you rename the modified object to help avoid confusion.
You don't need to change any of the objects in this case. The object "TestClassic" should do what you want. "Extended_FDS" behaves a lot like "Parallax Serial Terminal"(.spin) that is used in the LMR tutorial.
Follow the tutorial in opening PST (the PC program) and set it to a baud of 115200. Load "TestClassic" into your Prop with "F11" and it should output the data from the controller to PST.
Do you have some sort of adapter for connecting and powering the classic controller? Which Propeller board are you using.
I list some Propeller tutorials in post #3 of my index (see my signature).
I think it should be relatively easy to do what you want...
I'm pretty sure GadgetGangster.com or PropellerPowered.com sell boards that directly connect to the Wii i2c controllers.
Or, you can buy adapters elsewhere.
For the serial connection, the Propeller Tool comes with "Parallax Serial Terminal" you can use as a serial monitor on the PC side.
On the prop side, try the "Parallax Serial Terminal Demo" that also gets installed with the Prop Tool.
Of course, "easy" is relative. Crack open the PEK documentation and get to it. Understand the fundamentals BEFORE you attempt your application. I believe that if you dive too quickly into your application code you will ultimately have more problems that you otherwise would -- this happens to newcomers all the time.
the underwater rov (remotely operated vehicles) we are building will have 4 motors to move it and one or more manipulators and possibly some sensors that will all need to be controlled from surface. the motors cant run off the power supply on the propeller so what happens is the chip turns on sets of transistors that directs voltage from a 12 volt battery to the motors in both forward and reverse directions so each button pushed needs to send the max number of volts (3.3) to a transistor.
i dont have a conventional chip but a 'propeller stamp" which is like a propeller stamp on a basic stamp chip, having the same number and configuration of pins. so in the original code would i want to change pines 28 and 29 to say 4 anf 5 because i cannot connect to pins 28 and 29.
im currently using the "board of education" to poser the stamp but have also made a breadboard version that does not use the board of ed, but i haven't yet made a voltage regulator and use 9 volt battery so i've been sticking with the board of ed.
and the wii classic controller has the 4 main wires wired into their own adapter for the wii remove, but i know which of the holes on the adapter connect to each wire. my question here is, can i simply put wires into the holes on the adapter and expect it to work or should i just cut if off and use the leads from the main wire? the main wire is composed of the 4 sda slc volt and ground cables and sounded by smaller copper cables. but i've found that the smaller wires serve no purpose other then to tell the contriver if its connected to the remote or not. can i disregard theses or do i need to tell them they are being connected?
-- http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Classic_Controller
I've attached a demo program I wrote for the EFX-TEK HC-8+ that uses my I2C and Wii objects; this should give you a head start with the Wii.
thank you for that link its very helpful! and that's actually good news to me because i had an idea for the control method using the joysticks that would be easier to do with smaller numbers on the potentiometer.
my idea goes like this, and correct me on anything if im wrong, but the values of the x and y pots make up a coordinate plain and so if i assign motor positions (varying motors on/off or reverse will result in different turns/turn radius ) to values of both pots at once like i was plotting a point i should be able to control the vehical well using the joystick so i would probably want to debug the pots to see what points are where and then code a program that turns on the correct motors, only im not sure how exactly i would do ether of those last 2 things.
Welcome and have fun. By the way, is this a or a variant of the Sea Perch ROV?
Frank
Hi Maggie,
Ambitious project.
I worked for Perry Oceanographics (way back when) and have written quite a bit of software for ROVS.
(all Z80 assembly) though.
First up - communications link. Talk to the ROV and get data back.
Really easy with the Prop and your choice of serial drivers from the OBEX.
USB communications won't get it. Too limited by range (distance).
Trying to control all from the surface system won't work.
It takes WAY too may wires between surface and ROV - even for a simple demo.
Plus the losses in the cable.
This will probably just take one cog (processor in the Prop).
That leaves seven cogs for the rest of the work.
Next comes control.
That's when the motors, sensors, manipulators come in.
It might turn out that you want to use one cog per motor for control and feedback.
Or maybe you'll work out control of several motors in one cog.
That's up to you and your team.
For your project, I'd say break down the ROV requirements into easily managed chunks
and address each in turn. Make a motor move, get positions, read the sensors...
Then pull all of that into the final application.
Manipulators will probably all need positional feedback (at the very least),
And variable speed on the motors so velocity (rpm) feedback on the drive and steering motors...
(dig through the OBEX for PWM examples)
Otherwise you really won't know what's happening down below.
My gut feel, though, is that depending on how involved your ROV gets, more than one Prop may be needed.
But you'll know more about that as it comes together.
As for Spin, just byte the bullet and dig in.
It's not a difficult language - just a pain in the patooty to type sometimes.
The structure of the program is indicated my indentation - nor brackets or end markers (end if, or end of loop).
So editing can get "interesting". Best suggestion is DON'T change the tab stops in the editor.
(We regularly burn Chip in effigy for that at my house - Sorry Chip )
First thing to do is to blink some LEDs, read some buttons.
That's one reason the Quickstart board is so wonderful.
It has 8 leds, and eight touchpads (buttons) to play with.
It makes a good (and inexpensive) learning tool.
But for your actual run-time hardware in the ROV, you are going to need more pins.
Take a look at a couple of other offerings.
Top of the list (for this) - Martin Hodge's DNA board.
It's a "Propeller Platform" type board with many of the toys you will need anyway already on board.
http://mghdesigns.com/index.php?main_page=product_info&cPath=1&products_id=1
Having the connections along both edges makes for a very secure physical arrangement.
Your custom ROV interface circuitry can be built and plugged into the board and (by using stack-through
connectors) even stacked up several layers high. Might be handy?
(Word - wire up two or three of each custom board. You WILL know why before it's all over.)
Martin also offers his ASC board which is a Propeller board with Arduino form factor.
Depending on if you can find what you need with Arduino shields (off the shelf?).
(ASC has one thing that makes it stand out for this kind of work - a real ADC chip on board.)
Lastly, for now, don't forget to put a fan in the can!
(as well as conformal coating everything that has electricity in it)
(Can is the term for the electronics container of the ROV.)
It will help keep the condensation problem under control.
Monitoring temperature and humidity would be wise as well.
Power:
Switch the 9v battery to a 4 cell AA pack.
They last longer and don't need any further regulation.
Oh, and have fun!
Richard
So, what has that got to do with this thread? Nearly everything. The dual stellant head can inject both contrast and saline under programmed sequences. One gums up the works badly and the saline is not only highly conductive (image turning on all transistors in an H bridge due to this sort of short in the controls) not to mention that the saline will also thoroughly destroy anything metal it comes in contact with. This example only uses the costs of damages to make the point regarding operation of anything in a hostile environment; the very first mention I can recall seeing here since I have been hanging out on this thread. At the hobbiest level most of us will not have to operate under harsh conditions, but this one? Then again, doggiedocs chicken coop (Carolinas: high humidity, dust, animal dander, etc.). Component repairs on the stuff we could do in the Navy were at times a bear because so much had conformal coatings to protect it from corrosion in salt air.
Excellent catch Richard.....
Welcome, you may wish to look at the M44D40 by WBA Consulting as your propeller processor. Also Jay Kickliter did a bunch with an ROV project using a propellar you might do a forum search for that.
Jim
http://forums.parallax.com/showthread.php/131290-New-Propeller-ROV
right now it reads "PUB init
uart.start(31, 30, 0, 115200) 'start UART at 115200 on programming pins
classic.init(3,4) 'initialize I2C Classic Controller on existing I2C pins
mainLoop 'run main app"
where it says 3,4 it used to have the 28,29 and i have the wires plugged into the codinating pins(with resistors) should i also change that 31, 30, 0? im not sure what they reffer to.
and the wii classic controller has the 4 main wires wired into their own adapter for the wii remove, but i know which of the holes on the adapter connect to each wire. my question here is, can i simply put wires into the holes on the adapter and expect it to work or should i just cut if off and use the leads from the main wire? the main wire is composed of the 4 sda slc volt and ground cables and sounded by smaller copper cables. but i've found that the smaller wires serve no purpose other then to tell the contriver if its connected to the remote or not. can i disregard theses or do i need to tell them they are being connected?
should this be aoutmaticly sending the bottons pressed to the serial terminal or do i need to code it to do so?
Jonny Macs code shows the values on the serial terminal.
(if you don't like to wait for an answer in cases like this just try your assumption by loading the code into your hardware and look what happens.)
best regards
Stefan