Shop OBEX P1 Docs P2 Docs Learn Events
Technical resources for Scribbler 2 — Parallax Forums

Technical resources for Scribbler 2

paggerspaggers Posts: 5
edited 2014-02-09 07:10 in Robotics
I'm new to the forum (as you can no doubt tell) so hello everyone. I'll start by apologising in case this is one of those questions that has been asked innumerable times but I have spent a fair bit of time searching the forums and the Parallax website and no joy so far. Probably the answer is right under my nose but if so I guess I need someone to push my nose out of the way for me!

Okay, so here is the story. Twenty years ago I did my degree in microelectronics which involved programming microprocessors and microcontrollers to operate robotic systems. We started off programming at low level and worked our way up to languages like C. After leaving university I got interested in C++ and programmed in it as a hobby for quite a few years before other interests pulled me away. Three years ago I bought a Scribbler S2 hoping to interest my son in robotics and programming, but it never really took off so the robot was carefully packaged up and forgotten about.

Now I don't know if it's mid-life crisis or whatever but suddenly I find I want to rediscover my old skills and I have set myself the project of creating (from scratch) a C++ class capable of controlling the S2. It's possible that there is already one out there (although in my research I didn't find one, just the Mypro-C++ one which is for the Scribbler S1 with something called a Fluke attached and so not exactly the same) but anyway the whole point is to create my own as a project. I should also point out that I will be using SimpleIDE on a Mac so even if I wanted to use it the GUI is of no use to me.

What I am currently struggling with is the technical details of how the Propellor interacts with the various resources on the S2. I can write code to the Propellor no problem, and I have a schematic showing which I/O pins are connected to what, but I cannot work out how to control or get data from any of the devices. So what I am looking for is a resource that explains how to directly control the various devices on the S2. It doesn't need to be language specific, I'm interested in the mechanism of how the Propellor controls these devices - I can work out from there how to deliver that in C/C++.

Hopefully there is something somewhere that provides this information. So I would be very grateful if someone could point me in the right direction.

Comments

  • TtailspinTtailspin Posts: 1,326
    edited 2014-02-07 19:01
    Welcome to the forum paggers.
    I think you are trying to say, You are a software guy, and not a hardware guy?:smile:
    The Scribbler 2 is an awesome machine, I have a great time with mine, Don't be afraid to void the warranty,
    Check out what fellow forum member Gareth is doing to his S2...:thumb:


    -Tommy
  • paggerspaggers Posts: 5
    edited 2014-02-08 02:46
    Thanks for the welcome Tailspin.

    In truth I could build my own equivalent of the S2 - as I mentioned my background is in microelectronics so it should not be beyond me (not that it would be anywhere near as good of course). But if I did that then I would know how it was built and how to address the various components whereas with the Scribbler I don't have that information. Looking at the schematic there appear to be multiplexers, wheel drive controllers, etc in there and without a guide of how I get the Propeller to talk to them I can't get any life out of the machine.

    You are not wrong however in the sense that right now I want to first focus on the software side - and the S2 should be an ideal platform for that if I can just work out how to talk to it. Once I feel that I am on top of that once more my plan is to progress on to the hardware side of things - for example one of my plans is to build a Propellor-based AUV to explore the various canals we have near where I live.

    I will take a look at what Gareth is doing, thanks - but at this point mostly I need help with how to talk to the S2. To be honest I have been a bit surprised that there is not more information available online on how the S2 works, and given what people are doing with it on this forum the information must exist somewhere.
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-02-08 06:53
    paggers,

    If you download the S2 GUI and install it, there is a S2.SPIN file that get set up. This is the code that has all the routines that interface to the S2 hardware. If it is a part of the S2, there is a routine in S2.SPIN that talks to it.

    With this code and the S2 schematic (available on the S2 page) you pretty much know where all the hardware is attached and have some example code (very good code) of how to talk to the component.

    It sounds like you have the background in HW and SW to work with this information and generate the C/C++ code you need.
  • TtailspinTtailspin Posts: 1,326
    edited 2014-02-08 07:05
    I think "S2.spin" is really well documented, I wonder if some study of that code would be helpful to you?
    It is the brains of the operation, and is what communicates with the sensors and wheels of the S2...:)


    -Tommy
  • paggerspaggers Posts: 5
    edited 2014-02-08 07:51
    Cheers chaps, I'll give that a go, although as a Mac user I can't use the S2 GUI (I did mention that in the OP). But if I can make sense of the S2.spin then I agree I should be able to reverse engineer that to work out what I need to do with C.

    Took the lid off the 'bot earlier today and with the help of a magnifying glass found the ID number of the MUX chips and hence downloaded the relevant data sheet - so if necessary that's the fallback plan for working out how to deal with the sensors.
  • PublisonPublison Posts: 12,366
    edited 2014-02-08 07:57
    It sounds like you are on a Mac? so you can't run the GUI.

    I attached the the Help Folder (zipped).

    If you open "english_help.html" and go to the bottom left, and click on "S2 Spin Object Documentation", all the methods are broken down for each section. (click "Source Code" in each section to expand)

    Jim
  • paggerspaggers Posts: 5
    edited 2014-02-08 08:33
    Thanks Publison, that's a lot easier to parse than wading my way through the S2.spin file.

    I'm struggling a bit with the spin though, probably just inexperience with the language. From what I can see the method run_motors is the 'lowest level' method for controlling the motors but try as I might I cannot work out from the source code what it actually tells the Propellor to do. Sorry if this is really simple and I am missing something but as far as I can tell the code below contains only variables and no actual command!
    if (command & MOT_IMM)
    <tab> long[@Motor_Rdist]~
    <tab> long[@Motor_cmd]~
    else
    <tab> repeat while long[@Motor_cmd]
    Motor_Rdist := -32767 #> right_distance <# 32767
    Motor_Ldist := -32767 #> left_distance <# 32767
    long[@Motor_cmd] := timeout << 16 | (0 #> max_speed <# 15) << 8 | (0 #> end_speed <# 15) << 4 | command & (MOT_IMM | MOT_CONT)
    if (left_distance or right_distance)
    <tab> timeout := cnt
    <tab> repeat until moving or cnt - timeout > 800_000


    If someone can explain to me where in that is the actual command that tells the Propellor how to drive the motors it would help me make sense of it.
  • paggerspaggers Posts: 5
    edited 2014-02-09 07:10
    Have given up on trying to understand spin and I am making use of the 'simpletools' functions provided along with simpleIDE. So far I have managed to work out how to control the motors, the speaker and the push button (all fairly simple). Currently trying to work out why Obs_Rx always returns TRUE even when it is set to an input and the Obs transmitters are turned off. Making some progress though so that's all good.
Sign In or Register to comment.