go away spammer

Author Topic: Robot Builder's Bonanza Basic Stamp 2?  (Read 2548 times)

0 Members and 1 Guest are viewing this topic.

Offline arrrrgonTopic starter

  • Jr. Member
  • **
  • Posts: 37
  • Helpful? 0
Robot Builder's Bonanza Basic Stamp 2?
« on: February 23, 2011, 01:16:48 PM »
If I buy the Robot Builder's Bonanaza book, will I be able to do the projects using the atmega328 or will I have to use the basic stamp 2?

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: Robot Builder's Bonanza Basic Stamp 2?
« Reply #1 on: February 23, 2011, 04:56:58 PM »
You would have to use the basic stamp or change the circuits and code to suit the atmega.
Maybe you could find this online already done but i doubt it.
Howdy

Offline hopslink

  • Robot Overlord
  • ****
  • Posts: 202
  • Helpful? 14
Re: Robot Builder's Bonanza Basic Stamp 2?
« Reply #2 on: February 23, 2011, 05:16:11 PM »
Looking at the 4th edition which is due out in June, the microcontroller/programming side looks to be based round the Arduino environment - so it is probably well worth the wait if you want ATmega based examples.

If you can't wait the only thing to stop you doing the projects with the ATmega is your ability level, getting things working will be a lot harder since you will have to port the code. How strong is your programming?

If you are looking for an Atmel and C based starter project then the SoR 50$ robot is a good one. It has everything you need to get going inexpensively (for robotics) and you will learn a lot about building up a microcontroller board and interfacing it to servos and analogue sensors. There are then guides to expand it, adding other sensors etc. Build it with an ATmega328 and use the excellent Webbotlib, or modify it to work with the Arduino environment if that takes your fancy. What you learn would also likely be directly applicable to the 4th edition when it arrives, you should find you are off and running.

Offline arrrrgonTopic starter

  • Jr. Member
  • **
  • Posts: 37
  • Helpful? 0
Re: Robot Builder's Bonanza Basic Stamp 2?
« Reply #3 on: February 23, 2011, 09:18:24 PM »
I did the $50 robot already and I'm waiting on my ir rangefinder atm.  The book looked like a good way to expand my knowledge, but I was hoping to stick with the atmel mcs.  The programming side doesn't worry me, its the electronics side I don't know much about.

Offline rbtying

  • Supreme Robot
  • *****
  • Posts: 452
  • Helpful? 31
Re: Robot Builder's Bonanza Basic Stamp 2?
« Reply #4 on: February 23, 2011, 09:43:54 PM »
The book is oriented around a different MCU, and you'd need the knowledge of electronics that you (apparently) aren't yet confident enough in yet to adjust the schematics to the ATMega328p. 

A worthwhile project would be implementing UART and using that (along with either a long usb/serial cable or a light laptop) to make a remote-controlled bot: the amount of additional hardware is minimal, so it should be simple enough to do.

Offline arrrrgonTopic starter

  • Jr. Member
  • **
  • Posts: 37
  • Helpful? 0
Re: Robot Builder's Bonanza Basic Stamp 2?
« Reply #5 on: February 23, 2011, 09:53:23 PM »
Thanks, I'll look at the UART tutorial.

Offline arrrrgonTopic starter

  • Jr. Member
  • **
  • Posts: 37
  • Helpful? 0
Re: Robot Builder's Bonanza Basic Stamp 2?
« Reply #6 on: February 23, 2011, 10:06:26 PM »
Ok, so I realized my answer was a bit ambiguous.  An example of something I'm wondering about is how I would go about having more than 5 servos or more than 6 sensors.  Another thing is how to add in sensors other than the ones that Admin teaches in his tutorials.  Let's say I wanted to add a tactile bump sensor.  How do I figure out what signal the sensor is sending to my microcontroller in order to add it to the program?  Another think I've been trying to understand is how to use a tx/rx set such as the tws-434 and rws-434 to interface with the atmega328 to control the $50 robot. I think the $50 robot tutorial is great, I'm just not sure how to take the next step.  I like the idea of building the entire board from scratch.  It's not that I don't think the pre-built boards are useful, it's that I'd like to learn more by making my own boards before going on to something pre-built. 

Thanks for the help.
« Last Edit: February 23, 2011, 10:15:11 PM by arrrrgon »

Offline rbtying

  • Supreme Robot
  • *****
  • Posts: 452
  • Helpful? 31
Re: Robot Builder's Bonanza Basic Stamp 2?
« Reply #7 on: February 24, 2011, 02:27:06 AM »
For more servos/sensors than you have microcontroller pins, look into shift registers (easily googled).  If you have extra pins, just solder in some more headers, and you'll be up and running quickly. 

For the tx/rx set, you may want to look into how the Arduino VirtualWire library works (which is written for a similar Tx/Rx, I believe).

For sensors, this is a general guideline:

Sensors that vary voltage will require ADC inputs (which are limited).  These include but aren't limited to light sensors, IR rangefinders, accelerometers, and gyroscopes. 

Sensors that either are a physical switch (bump sensors, buttons, etc) or have a built-in schmitt trigger or comparator of some sort can be connected directly to GPIO for logic high & low.

Sensors that have built-in microcontrollers usually interface through UART, I2C, or SPI - knowing how to implement communications in these three protocols helps a lot.

The "next step" would be, in my opinion, to work on UART (requiring a hardware upgrade to a crystal or resonator instead of the internal RC timer) - having debug information printed out helps tremendously when dealing with more complex robots.

Offline arrrrgonTopic starter

  • Jr. Member
  • **
  • Posts: 37
  • Helpful? 0
Re: Robot Builder's Bonanza Basic Stamp 2?
« Reply #8 on: February 24, 2011, 04:31:21 PM »
Ok, I'll have to order the parts for the UART. 

Can you explain the GPIO to me a bit more.  I looked it up and I have a general idea of how it works, but I can't figure out which port would be the GPIO on the ATMEGA8.  I looked at the datasheet for a while, but I don't understand it yet.  As an example, if I wanted to add a bump sensor to the $50 robot, using this sensor http://www.pololu.com/catalog/product/1402, I believe that I would connect pin 1 to the 5v, and then pin 3 ( the middle pin) to a resistor which is connect to the ground, and then I believe that pin 3 would also connect to the microcontroller, but I don't know which pin. 

Do my connections sound right?

If so, which pin on the MC would I connect to?

Thanks again for your help.

Offline arrrrgonTopic starter

  • Jr. Member
  • **
  • Posts: 37
  • Helpful? 0
Re: Robot Builder's Bonanza Basic Stamp 2?
« Reply #9 on: February 24, 2011, 04:48:55 PM »
Am I correct that PB6 and PB7 are both GPIOs?

Offline joe61

  • Supreme Robot
  • *****
  • Posts: 417
  • Helpful? 16
Re: Robot Builder's Bonanza Basic Stamp 2?
« Reply #10 on: February 24, 2011, 06:14:35 PM »
Ok, I'll have to order the parts for the UART. 

Can you explain the GPIO to me a bit more.  I looked it up and I have a general idea of how it works, but I can't figure out which port would be the GPIO on the ATMEGA8.  I looked at the datasheet for a while, but I don't understand it yet. 

If you look at the "Pin Configurations" section of the data sheet, it shows all the pins, each with some notations next to them. The notations are abbreviations for the various things you can do with each pin. So if you start with pin 1, you see that next to it it says (RESET) PC6. This indicates that that pin is used to reset the chip. Later in the sheet it says how you do that, but I won't get into that now. The "PC6" means it's pin 6 in Port C. (Ports are groupings of pins - the data sheet explains them in the section "I/O Ports".

So back to the pins. Pin 2 has "(RXD) PD0" next to it, which means it can be used as the receive pin when using the USART. If you're not using the USART you can use it for whatever you want - blink a LED or whatever. So most of the pins can either have specific uses, or be GPIO if you're not using their special talents.

Try looking through the data sheet to find what the other notations mean. That will probably make you more comfortable finding your way around.

Then check specific sections of the data sheet to find out how to do specific things. For example, the section titled "USART" tells you how the USART works. The section titled "8-bit Timer/Counter 0" is about how to use the 8 bit timer, and so forth.

Reading the data sheet is a learned skill, but it's important to be able to do it. Take a shot at it, it's worth it.

Joe

Offline hopslink

  • Robot Overlord
  • ****
  • Posts: 202
  • Helpful? 14
Re: Robot Builder's Bonanza Basic Stamp 2?
« Reply #11 on: February 24, 2011, 06:41:54 PM »
Quote
Am I correct that PB6 and PB7 are both GPIOs?
Yes - all the pins except the power pins (digital and analogue) the analogue voltage reference pin and the reset pin are GPIOs. Any of these pins can be configured to be a digital input or output. It doesn't matter which you connect to as you change your software to use the pin you want.

Though they are all GPIOs they all have other specific functions, as joe61 says, so six pins can also function as analogue inputs (the sensor inputs), two are used by the hardware UART etc etc. Generally you decide which functionality you want for your project and assign pins first based on their specific hardware associations. After this you are usually left with a choice of pins for remaining general IO. Your bump sensor fits into this general category if you are polling its value in your software.

If you look at the photo of the switch you can see the legends C, NC and NO next to the leads. These stand for Common  - which you would connect to the IO pin on the micro, Normally Open and Normally Closed. When the switch is unpressed the Normally Closed and Common leads are electrically connected, when the switch is pressed these are disconnected and a connection is made between the Common and Normally Open leads. So the voltage on the Common lead, and thus at the micro pin will depend on the position of the switch, and which supply rail you connect the NC and NO leads to (choose 5V pressed and 0V otherwise, or 0V pressed and 5V otherwise it makes no real difference).

Provided there is never a short between the NC and NO leads (there shouldn't be, but check with a meter) you do not need a resistor, but it is good practice to put a 220Ohm resistor between the switch and the micro pin as it will limit current through the pin to a safe level if you ever configure the micro pin incorrectly. If there were a short between NC and NO then you would need a higher value resistor (generally 10KOhm) connected between NC or NO and a supply rail to limit current flow between the rails (again it doesn't matter which side you connect it, just that it's there).

As for the UART, if you don't have a serial port on your PC, or would sooner use USB anyway then it is probably worth ignoring RS232 and level shifting and just going with a USB to TTL serial adapter since most of the other devices you might want to connect to the micro will probably be TTL level too and it makes things simpler. RS232 is increasingly rare nowadays.

Offline arrrrgonTopic starter

  • Jr. Member
  • **
  • Posts: 37
  • Helpful? 0
Re: Robot Builder's Bonanza Basic Stamp 2?
« Reply #12 on: February 24, 2011, 11:34:15 PM »
Thanks for the info guys, the datasheet makes a lot more sense now.  I think I'll go with a usb to ttl for the uart.

 


Get Your Ad Here