Shop OBEX P1 Docs P2 Docs Learn Events
I need. Help programming basicstamp2 dagu motodriver — Parallax Forums

I need. Help programming basicstamp2 dagu motodriver

FieldexFieldex Posts: 7
edited 2012-07-03 12:30 in BASIC Stamp
Hello,
I'm relatively new in he field of electronics, microcontrollers and robotics, i do not have a technical background.
I started with wam and boe bot, and getting more and more interested. The idea is now to build a tracked robot to sent to places i cannot reach with mij wheelchair, i already bought a dagu rover5 and a dagu 4 channel motordriver (because i thought speccially made for each other). And control it with bs2

Learned from my bs excersizes to test all seperate parts of a setup to avoid the needle and haystack phase.

I ended up after testing 3 motors with a fried motordriver bij testing motor 4.

I used in that set up the pulsout command sending it to the pwm pin of the appropiate motorchannel on the driver, as said it worked with 3 motors at motor 4 first some murmer from the motor and smoke from the driver.

Through internet searches found someone, who got the machine running, based on an arduino set-up, and he gave me the following answer and some code used.as follows :
Quote
PWM -> This needs to be connected to a digital output of the arduino, but one that supports PWM modulation. Not all digital outputs support PWM, so you need to be careful here. On an Arduino Duemilanove (ATMEGA328) they are the pins 3 , 5, 6, 10 and 11. On an arduino Mega 2560, they are the pins 2 to 13. Take your board and check for "PWM" beside the pin connectors to know which are supported. Once you've figured which pins to use, in your code, you pass a value between 0 and 255, where 0 is no power and 255 is full power. Example:
#define ENGINE_PIN 3
setup() {
pinMode(ENGINE_PIN, OUTPUT);
}
loop() {
analogWrite(ENGINE_PIN, 128); // Run at half speed.
delay(10000); // Wait 10 seconds.
analogWrite(ENGINE_PIN, 0); // Stop
delay(10000); // Wait 10 seconds.

Unquote

After reading and digging in. Bs2 docs found PWM command and its description, and got even more confused.

It really confuses me, because different proccessor different code-platform, and scared to fry another set up.,

Could anyone tell me, what the pwm-pin does expect, and command in pbasic generates that signal?

Any help much appreciated.
Thanks in advance
Jean

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-06-25 07:13
    The PWM command will not do what you want. It's intended to be used with a resistor and capacitor as a filter (as shown in the Stamp Manual) to produce an analog voltage. It uses Pulse Width Modulation to do this, but this signal is not appropriate for use for motor control. The Stamp is not designed to produce the kind of PWM signal that the Dagu motor driver expects. It can "sort of" do it using pairs of PULSOUT statements, but only for one motor at a time. If you want to control more than one motor at a time, you'd need something like the Propeller that can generate the sort of PWM signal you need.
  • FieldexFieldex Posts: 7
    edited 2012-07-02 13:39
    Thanks for the quick answer, sorry for the late reply.
    I was really dissapointed at first, but Obsessed as i am and with some luck after a lot of google time and a lot of reading finally stumbled over the word pwmpall, and came back at parallax. Unfortunately does your dutch agent not suply this particular part, so could you please tell me how i can obtain one.?

    Thnks in advance
    Jean
  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-02 21:00
    I forgot about the PWMpal. That might do what you want. Have a look at the documentation (see the webstore page for the product) and see if you have any questions after you look at it.
  • FieldexFieldex Posts: 7
    edited 2012-07-03 12:30
    Yeah like to buy it, , antratek cannot deliver, any other europe dealer?
Sign In or Register to comment.