Shop OBEX P1 Docs P2 Docs Learn Events
Newbie questions — Parallax Forums

Newbie questions

HackWarHackWar Posts: 17
edited 2010-08-31 19:59 in Robotics
I bought the BoeBot kit last week and so far it has been a fantastic introduction to robotics. I'm an experienced software developer but I did not have any experience in combining it with hardware. So it didn't took me long to learn the PBASIC language. However I learned a lot about prototyping circuits, and the book was really helpful and the Ping))) sensor works fantastic!

I still do have got a couple of questions which I'd like your comment on:

1. The breadboard on the Boe seems rather small which makes it hard to add a lot of sensors/led's/etc... Is there an easy way to extend the Boe breadboard with a larger one?

2. In the PBASIC language if you need to store over 256 bytes, your only option is to use a WORD (or an array of BYTE). Is there no other type between the BYTE(256) and WORD(65536)? The WORD type might reserve a lot of memory I won't use, and the BYTE is too small. I've never had to deal with these kind of memory issues when declaring variables, so your help is appreciated.

3. The BASIC stamp does not provide a lot of memory and does not support multithreading. For example: i'd like to have my boe bot scan the area while driving at the same time. So it seems I'm in need of a new microcontroller which does support that, but it probably won't fit on the Boe. Am I right?

Thanks in advance for your help!

Comments

  • John R.John R. Posts: 1,376
    edited 2010-08-26 07:28
    You can use a larger breadboard by running jumpers from the BOE to a separate breadboard.

    With respect to memory, you're kind of stuck with multiples of byte, so, yes, you might waste some space. Keep in mind, most of the funcations are also using byte or word sized arguments and results, so even if you went to the trouble of using an alternate lenght for a given variable, you'd probably loose more space in programming to put and pull the data than you saved in storage.

    There are multiple versions of the Stamp with different amounts of memory, etc., and looking at other options there might be a first step.

    Given the concern for memory and multi-threading, I'd say you might want to look at the Parallax Propeller. It is an 8 core multi-processor chip, and carries the same Parallax support community. There are number of choices in getting started with the Prop, namely the Prop Demo Board, Prop Education Kits, Prop Prototype Boards, Pro Development Board, Prop Robot Board and a plethora of 3rd Party Boards and modules.

    There are folks who have mounted one of the prop boards on the BOE Bot. It would be a great transition, and one I would highly recommend.


    John R.
  • HackWarHackWar Posts: 17
    edited 2010-08-26 07:43
    Thanks John, quite helpful information! I was already thinking of trying the Propeller and a corresponding board.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-08-26 10:11
    Have a look at BoeBotBasic which can be downloaded from the Propeller Object Exchange. It's a standalone Propeller BoeBot Basic that supports the wheel motors, a PING and PING servo bracket, IR distance sensing, and an HM55B compass. Programs can be stored on an attached SD card and the "console" can be done wirelessly using an xBee transceiver. It was originally tested using a stock BoeBot with a SpinStamp substituted for the BS2, but revised to use a Propeller Protoboard instead of the Board of Education. There's a project with photos in the Completed Projects forum ...

    http://forums.parallaxinc.com/forums/default.aspx?f=21&m=175444
  • ZootZoot Posts: 2,227
    edited 2010-08-26 11:04
    I think you mean store a number whose VALUE is > 256 but not as big as 65535 ($FFFF). There are some tricks, you just need to rememer what you are doing. This is often referred to as "packing", i.e., using some bits in a variable (but not all) for storing values. Here is an example:
    My12BitNumber VAR Word
    My4BitNumber VAR My12BitNumber.NIB3
    ' so at this point I have a word variable where I am planning
    ' on using the lowest 12 bits for a number ranging from 0-4095
    ' then I "aliased" the highest nib (upper 4 bits) to use as some other
    ' value from 0-15
    ' the trick now is to "mask" off the bits I'm not working with when
    ' I write or read the 12 bit value. The 4bit value is ready to go
    ' as Pbasic supports "nibbles" as variables, e.g.
    
    FOR My4BitNumber = 0 TO 15
        My12BitNumber = ( ( My12BitNumber & $0FFF ) + 1 MAX $FFF ) & $FFF | ( My4BitNumber << 12 )
       ' the above masks off the upper nibble, adds 1, then ensures
       ' that the number doesn't "rollover" into the upper nib, which would
       ' clobber my 4 bit variables, then ORs the maintained value of the 4bit
       ' nib back on
       DEBUG "4bit val: ", DEC2 My4BitNumber, CR
       DEBUG "12bit val: ", DEC4 ( My12BitNumber & $FFF ), CR
    NEXT
    
    

    Depending on what you need, you can "pack" 5 bit values (0-31), 7bit values, etc. into Words and Bytes -- just make sure you mask appropriately. In the above, I used a single expression, so that the Stamp moves the variables into its "internal" workspace. It might be clearer to set up a "work" variable to see what's really happening:
    My12BitNumber VAR Word
    My4BitNumber VAR My12BitNumber.NIB3
    work VAR Word ' resuse over and over as you need for "temp" space
    
    FOR My4BitNumber = 0 TO 15
       work = My12BitNumber ' move to workspace
       work = work & $FFF ' mask off the nib -- now the "real" 12bit number value is here
       work = work + 1  ' do stuff to the value
       work = work * 2  ' etc
       work.NIB3 = My4BitNumber ' move the 4bit number to where it belongs
       My12BitNumber = work ' and save the "packed" variable
      ' note that the above takes a lot more code space 
      ' and requires a work variable, but it's clear
    NEXT
    
  • HackWarHackWar Posts: 17
    edited 2010-08-26 11:17
    Thanks Zoot! Yes that would definitely decrease the amount of unused space, brilliant, thanks!
  • schillschill Posts: 741
    edited 2010-08-26 11:20
    HackWar wrote: »
    3. The BASIC stamp does not provide a lot of memory and does not support multithreading. For example: i'd like to have my boe bot scan the area while driving at the same time. So it seems I'm in need of a new microcontroller which does support that, but it probably won't fit on the Boe. Am I right?

    A Propeller has been suggested for this (which is a great suggestion), but it shouldn't be necessary. There have been many, many robots built which do things like you are asking about with a single core processor (there aren't exactly a lot of multi-core microprocessors out there).

    You can do quite a bit inside a loop continuously running on your robot - spending a little time checking different sensors, a little time changing motor parameters, etc. Remember that these loops can run pretty quickly (there isn't any operating system overhead cluttering things up).

    You should be able to find numerous examples and there should be plenty of people here who can help. I expect that the Parallax documentation should cover it as well (although I haven't checked).

    So, you should be able to continue with the hardware you have (no need to wait for new stuff to arrive :) ).
  • ZootZoot Posts: 2,227
    edited 2010-08-26 11:23
    HackWar wrote: »
    Thanks Zoot! Yes that would definitely decrease the amount of unused space, brilliant, thanks!

    At the expense of codespace, remember. Certainly doing as much as you can in a single "expression" will cut down on codespace requirements, albeit with a slight loss of clarity.
  • Tony B.Tony B. Posts: 356
    edited 2010-08-26 12:25
    HackWar,

    I have used the SpinStamp with great success in a BOE-BOT. As Mike said the SpinStamp fits right in the BS2 socket on the BOE board. You will also need to buy the PropClip to be able to program it. Need to remember to us a 1k ohm resistor when connecting a pin to a 5v source, like a Ping sensor. Links and a picture of my SpinStamp BOE-BOT are below.

    Tony

    SpinStamp http://www.parallax.com/StoreSearchResults/tabid/768/List/0/SortField/4/ProductID/448/Default.aspx?txtSearch=spin+stamp

    PropClip - sorry Parallax's website went down just As I went to get this link.
    640 x 480 - 193K
  • HackWarHackWar Posts: 17
    edited 2010-08-26 13:04
    Tony B. wrote: »
    HackWar,

    I have used the SpinStamp with great success in a BOE-BOT. As Mike said the SpinStamp fits right in the BS2 socket on the BOE board. You will also need to buy the PropClip to be able to program it. Need to remember to us a 1k ohm resistor when connecting a pin to a 5v source, like a Ping sensor. Links and a picture of my SpinStamp BOE-BOT are below.

    Tony

    SpinStamp http://www.parallax.com/StoreSearchResults/tabid/768/List/0/SortField/4/ProductID/448/Default.aspx?txtSearch=spin+stamp

    PropClip - sorry Parallax's website went down just As I went to get this link.

    This is exactly what I was looking for, a picture of a working propeller chip on the boe board. Thanks, it looks great ;)

    @John:
    .... You can use a larger breadboard by running jumpers from the BOE to a separate breadboard ....

    Has anyone ever done this with the BoE? I'm still unsure how to do this.
  • Tony B.Tony B. Posts: 356
    edited 2010-08-26 18:39
    HackWar,

    What I would do is take a piece of 1/4 plywood or MDF(Medium Density Fiberboard) and cut it to match the size of the BOE and then drill for the four corner mounting holes. Then use four stand offs(like the ones that are used under the BOE) and mount the plywood/MDF plate above the BOE on the four stand offs. You may have to cut the heads off some 4-40 bolts to make short pieces of threaded rod to go between the bottom stand offs, BOE and upper stand offs. Then mount the plywood/MDF plate to the top of the stand offs and the larger bread board to the plywood/MDF. Then all you will need to do is run jumper wires from the pins you want to use to the bread board. I would have made one up to show you but my BOE-BOT is packed in the car ready to go to UPNE. If you have trouble don't hesitate to post your questions.

    Tony
  • HackWarHackWar Posts: 17
    edited 2010-08-31 11:39
    Tony, is it really that easy? I'm definitely going to try that before replacing my basic stamp with a propeller chip.

    Thanks!
  • Tony B.Tony B. Posts: 356
    edited 2010-08-31 19:59
    I believe so. EDIT: Do you have a CAD program or a way to read and DXF files. I could send you a template for making your plate with drill holes marked.

    Tony
Sign In or Register to comment.