Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Netduino TankBot


  • Please log in to reply
18 replies to this topic

#1 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 07 October 2010 - 08:21 PM

*Webmaster please move this to the Projects Showcase, thanks* I have stopped my random projects. I am now using the netduino for a project in computer class. I got my idea laid out and hopefully I can take it to some competitions and spread the word about the netduino. (OLD DELETED) UPDATE 10/15/10: The SN754410 Quad Half H-Bridge works GREAT with the netduino! I will try to post some code and diagrams soon. I have to get the Frizing program, I think thats what its called anyways. If you would like to see a sneak peek video go to http://oz.heliohost..../First_Look.wmv NOTE: The video should open in Windows Media Player right away, or download. Added: Diagram of Setup: Attached File  Netduino Two Motors.png   98.65KB   80 downloads Note: Vcc1 is where Netduino 5V goes into and Vcc2 is where battery V goes into. Use those as a reffrence. Also thanks to CW2 for the Netduino Part (http://forums.netdui...-fritzing-part/)

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 07 October 2010 - 10:04 PM

Oz, Do you want to use a motor (variable speed) or a servo (precise precision)? Most of the shields should work fine--although you only have 4 hardware PWM instead of 6. [But they're 16-bit instead of 8-bit, so that's a bonus.] So just make sure that the motors/servo connections you want to control are on the "middle 4" of the PWM pins. BTW, it's possible to create software PWM for 1-2 pins pretty easily...to match the six PWMs on the Arduino. Chris

#3 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 07 October 2010 - 10:28 PM

Oz,

Do you want to use a motor (variable speed) or a servo (precise precision)?

Most of the shields should work fine--although you only have 4 hardware PWM instead of 6. [But they're 16-bit instead of 8-bit, so that's a bonus.] So just make sure that the motors/servo connections you want to control are on the "middle 4" of the PWM pins.

BTW, it's possible to create software PWM for 1-2 pins pretty easily...to match the six PWMs on the Arduino.

Chris

probably motors, and maybe servos if I get to expand the project a little. so it is possible to get the motor shield from adafruit to work? and you know of other ones then I'd be glad to take a look at those too.

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 07 October 2010 - 10:36 PM

The Adafruit shield should work fine--and the DFRobot shield should work fine too. But perhaps someone else here has a motor shield and can pitch in... Chris

#5 ajcg1973

ajcg1973

    Advanced Member

  • Members
  • PipPipPip
  • 71 posts

Posted 08 October 2010 - 07:07 PM

While not a shield, I have found the TB6612FNG to be a great IC to use with low voltage motors. SparkFun sells a breakout board for the chip here (http://www.sparkfun....roducts_id=9457) for only $9.

Here is a simple class that I wrote to interface to the chip:
using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace AJB_NetMF_Classes
{
	public class AjbMotorTB6612FNG
	{
		private PWM _motor1;
		private uint _motor1Speed = 0;
		private OutputPort _motor1PinA;
		private OutputPort _motor1PinB;
		private MotorDirection _motor1Direction;
		private PWM _motor2;
		private uint _motor2Speed = 0;
		private OutputPort _motor2PinA;
		private OutputPort _motor2PinB;
		private MotorDirection _motor2Direction;
		private bool _usingBothMotors = false;
		private bool _isDisposed = false;

		public enum MotorDirection
		{
			Forward,
			Reverse,
			Stop
		}

		public uint Motor1Speed
		{
			get { return _motor1Speed; }
			set
			{
				if ((value <= 100) && (value >= 0))
					_motor1Speed = value;
				_motor1.SetDutyCycle(_motor1Speed);
			}
		}
		public uint Motor2Speed
		{
			get { return _motor2Speed; }
			set
			{
				if ((value <= 100) && (value >= 0))
					_motor2Speed = value;
				_motor2.SetDutyCycle(_motor2Speed);
			}
		}

		public MotorDirection Motor1Direction
		{
			get { return _motor1Direction; }
			set
			{
				switch (value)
				{
					case MotorDirection.Forward:
						_motor1Direction = MotorDirection.Forward;
						_motor1PinA.Write(false);
						_motor1PinB.Write(true);
						break;
					case MotorDirection.Reverse:
						_motor1Direction = MotorDirection.Reverse;
						_motor1PinA.Write(true);
						_motor1PinB.Write(false);
						break;
					case MotorDirection.Stop:
						_motor1Direction = MotorDirection.Stop;
						_motor1PinA.Write(false);
						_motor1PinB.Write(false);
						break;
				}
			}	
		}
		public MotorDirection Motor2Direction
		{
			get { return _motor2Direction; }
			set
			{
				switch (value)
				{
					case MotorDirection.Forward:
						_motor2Direction = MotorDirection.Forward;
						_motor2PinA.Write(false);
						_motor2PinB.Write(true);
						break;
					case MotorDirection.Reverse:
						_motor2Direction = MotorDirection.Reverse;
						_motor2PinA.Write(true);
						_motor2PinB.Write(false);
						break;
					case MotorDirection.Stop:
						_motor2Direction = MotorDirection.Stop;
						_motor2PinA.Write(false);
						_motor2PinB.Write(false);
						break;
				}
			}
		}

		// Construtor for a single motor
		public AjbMotorTB6612FNG(Cpu.Pin motor1Pwm, Cpu.Pin motor1DirectionA, Cpu.Pin motor1DirectionB)
		{
			_motor1PinA = new OutputPort(motor1DirectionA, false);
			_motor1PinB = new OutputPort(motor1DirectionB, false);

			_motor1 = new PWM(motor1Pwm);
			_motor1.SetDutyCycle(_motor1Speed);
			
		}
		// Construtor for dual motors
		public AjbMotorTB6612FNG(Cpu.Pin motor1Pwm, Cpu.Pin motor1DirectionA, Cpu.Pin motor1DirectionB, Cpu.Pin motor2Pwm, Cpu.Pin motor2DirectionA, Cpu.Pin motor2DirectionB)
		{
			_motor1PinA = new OutputPort(motor1DirectionA, false);
			_motor1PinB = new OutputPort(motor1DirectionB, false);
			_motor2PinA = new OutputPort(motor2DirectionA, false);
			_motor2PinB = new OutputPort(motor2DirectionB, false);
			_motor1 = new PWM(motor1Pwm);
			_motor2 = new PWM(motor2Pwm);
			_usingBothMotors = true;
		}

		public void Dispose()
		{
			this.Dispose(true);
			GC.SuppressFinalize(this);
		}

		private void Dispose(bool disposing)
		{
			if (!_isDisposed)
			{
				_motor1PinA.Write(false);
				_motor1PinB.Write(false);
				_motor1.SetDutyCycle(0);
				if (_usingBothMotors)
				{
					_motor2PinA.Write(false);
					_motor2PinB.Write(false);
					_motor2.SetDutyCycle(0);
				}
				_isDisposed = true;
			}
		}

		~AjbMotorTB6612FNG()
		{
			this.Dispose(false);
		}

	}	
}


And here is how you would use it:
AjbMotorTB6612FNG motors = new AjbMotorTB6612FNG(Pins.GPIO_PIN_D5, Pins.GPIO_PIN_D11, Pins.GPIO_PIN_D12);
motors.Motor1Direction = AjbMotorTB6612FNG.MotorDirection.Forward;
motors.Motor1Speed = 10;  // Set the motor to 10% speed


#6 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 09 October 2010 - 12:30 AM

I've decided on the Adafruit shield since it's not too pricey and can drive enough motors. Once they get some things back in stock I'll order a motor shield. Then I can take suggestions on how to write my own library. Chris, do you guys plan on testing or writing a library for the Motor Shield sometime soon?

#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 09 October 2010 - 02:55 AM

Hi oz, We'll look at writing a driver, but it'll be a bit before we can get to it... For most motor and servo control, you'll just use PWM--but there may be a special "motor control IC" on there which requires SPI/I2C communication... Chris

#8 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 09 October 2010 - 03:04 AM

Hi oz,

We'll look at writing a driver, but it'll be a bit before we can get to it... For most motor and servo control, you'll just use PWM--but there may be a special "motor control IC" on there which requires SPI/I2C communication...

Chris


Alright thanks for the heads up, I'll make sure I read the specs carefully before I buy.

#9 ajcg1973

ajcg1973

    Advanced Member

  • Members
  • PipPipPip
  • 71 posts

Posted 09 October 2010 - 06:51 AM

I've decided on the Adafruit shield since it's not too pricey and can drive enough motors.


Two suggestions after a quick glance at the product page...

Since the product comes as a kit and soldering is involved anyway, I would suggest that you solder on sockets under the L293D's in case of disaster (which can happen quite easily with motors), that way you can replace the IC's very easily.

If you have the few extra dollars, I would look at purchasing a couple of SN754410 chips as they are a drop-in replacement of the 293D but instead of the 600mA current they can drive up to 1000mA (almost double that of a L293D's sustained and max currents).

Hope that helps...

#10 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 09 October 2010 - 03:24 PM

Two suggestions after a quick glance at the product page...

Since the product comes as a kit and soldering is involved anyway, I would suggest that you solder on sockets under the L293D's in case of disaster (which can happen quite easily with motors), that way you can replace the IC's very easily.

If you have the few extra dollars, I would look at purchasing a couple of SN754410 chips as they are a drop-in replacement of the 293D but instead of the 600mA current they can drive up to 1000mA (almost double that of a L293D's sustained and max currents).

Hope that helps...


I realized that I have to solder now.... I dont have a good soldering Iron, that might put a hold on ordering that. Anyways thanks for the suggestions, I'll get the sockets at least.

#11 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 10 October 2010 - 01:54 AM

The Adafruit shield should work fine--and the DFRobot shield should work fine too. But perhaps someone else here has a motor shield and can pitch in...

Chris


I fell in love with this... http://www.sparkfun....products_id=315

I feel like it would teach me SOOO much if I wire it up myself. Also its made by TI and I love my TI-84 Plus SE, it helps in trig class :P
I like so much because its perfect for: http://www.sparkfun....products_id=319 and that would make a sweet car for my project.
After that I can mount some sensors and programm it up.

What do you think?

EDIT:
I found this video... its exatly what I want to do. I am glad I found it cuz it gave me an idea of how big the thing is:


#12 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 October 2010 - 10:47 AM

That looks very cool, oz. Just make sure that your H-Bridge drivers will recognize 3.3V TTL signals and you should be good to go... Chris

#13 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 10 October 2010 - 02:21 PM

That looks very cool, oz. Just make sure that your H-Bridge drivers will recognize 3.3V TTL signals and you should be good to go...

Chris


I amot reall sure what that mean :| but the data sheet is here: http://www.sparkfun....IC/SN754410.pdf
and here is some info from it
[qoute]
recommended operating conditions
MIN MAX UNIT
Output supply voltage, VCC1 4.5 5.5 V
Output supply voltage, VCC2 4.5 36 V
High-level input voltage, VIH 2 5.5 V
Low-level input voltage, VIL –0.3‡ 0.8 V
Operating virtual junction temperature, TJ –40 125 °C
Operating free-air temperature, TA –40 85 °C
[/qoute]

So I'll probably need lots of help figuring out how to use it, or I might figure it out after reading the datasheet OVER and OVER again. At least when I print that data sheet and brign it to my teacher she'll be happy that I'm trying to do something challenging :D

#14 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 October 2010 - 02:42 PM

It looks like 2-5.5V input is supported--so you should be fine. Chris

#15 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 10 October 2010 - 03:06 PM

It looks like 2-5.5V input is supported--so you should be fine.

Chris

great! thanks for the help... How do you think this will do in a science fair? My teacher said not many people are doing the computer science section.

#16 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 October 2010 - 03:15 PM

great! thanks for the help... How do you think this will do in a science fair? My teacher said not many people are doing the computer science section.


Hopefully it'll do awesome at the science fair...but I don't really know what people are building for science fairs these days.

#17 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 10 October 2010 - 03:21 PM

Hopefully it'll do awesome at the science fair...but I don't really know what people are building for science fairs these days.


Thats true, there no way to know...

I am right on the confirm order page and I just thought about something... Will that little chip fit on a breadboard? i have the half-size breadboard from adafruit (http://www.adafruit....&products_id=64). I need to figure that out, if you can before I do, please tell me.

Oh this might not be good... "Capable of driving high voltage motors using TTL 5V logic levels" it says right on the product page.

EDIT:
So it LOOKS like it will fit on a breadboard. but I'll email them and ask.
"Capable of driving high voltage motors using TTL 5V logic levels" I guess capable means it is possible but not neccesary tp use 5V, again I'll ask.

#18 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 October 2010 - 03:32 PM

Oh this might not be good... "Capable of driving high voltage motors using TTL 5V logic levels" it says right on the product page.


I'd drop the reseller or manufacturer a line and double-check with them... They should also be able to advise you on size, breadboards, etc.

Chris

#19 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 10 October 2010 - 07:14 PM

I'd drop the reseller or manufacturer a line and double-check with them... They should also be able to advise you on size, breadboards, etc.

Chris


well I emailed them about the TTL and breadboard. i scaled the pictures of breadboard and the chip, and they fit. I also saw another video which had the chip on a breadboard. Now I just need the people to get back to me about the TTL thing




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.