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.

Chris Seto

Member Since 06 Aug 2010
Offline Last Active May 05 2017 04:03 PM
*****

#23903 Controll two stepper motors via a wpf application

Posted by Chris Seto on 07 February 2012 - 02:43 PM

The term "deploy" is used to describe the process by which code is programmed on the Netduino, so no, it's not really possible to do anything without deploying. You'll have an app running on the Netduino listening to requests, and then an app on the PC sending them. This will be the case for pretty much any communication channel used, either USB, serial, Ethernet, etc. Over USB can be done with a user descriptor and the Netduino emulating some device (like a com port). This is not trivial to implement, though I have done it before.


#23818 Controll two stepper motors via a wpf application

Posted by Chris Seto on 05 February 2012 - 10:20 PM

Basically, you probably want to do this over ethernet, so get a Netduino Plus and setup a webserver on it to respond to commands over GET. All that means is that you'll be transferring data over the URL. For example... http://netduino/move?=down Your WPF program will be a web client and make these requests. You could also do it over serial.


#16967 Controlling 4 Brushless DC motors

Posted by Chris Seto on 23 August 2011 - 03:37 AM

Thanks very much for the reply.

In the past 24 hours I have also been looking at an idea from the Pololu website.

I was looking at this product -- http://www.pololu.co...og/product/1350 which is a servo controller for up to 6 servo's.

I was looking at this product -- http://www.pololu.co...og/product/1110 which will take 2 brushless DC motors.

The unique thing that I read about in the Servo controller is that they can be Daisy Chained together off of one TX pin. I have posted a question on Pololu forum to see if it would be possilbe to daisy chain the 6 channel servo and two brushless controllers. This would give me 6 servo's and 4 Brushless motors while just using one digial TX pin.

I would appreciate any comments regarding if this idea would work or not.

Thanks, John



You might want to refer to brushless motors as simply "brushless motors". The phrase "brushless DC" is contradictory -- brushless motors are inherently AC.

A servo controller would work for ESCS, however you will need to specially write an initialization sequence to arm the controllers.

The motor controller you linked will not work for brushless AC motors. Only for brushed DC motors. You will need a special ESC designed to control brushless motors, such as the Turnigy PLUSH.


#14431 Connecting Netdruino to MySQL db

Posted by Chris Seto on 17 June 2011 - 12:37 PM

There isn't really a good way to do this directly, as any full MySQL driver would probably take up most of the RAM and flash, however you could write a sort of REST API and tie the Netduino to that. Keep in mind, I would consider such a system to be highly insecure, due to the risk of someone unauthorized getting in to said REST API and either dumping or dropping the tables. A better option would be to expose any functionality you need through such a REST API and then secure upon that. This means that full MySQL queries can not be injected.


#14430 Would 16V be too high for a Mini?

Posted by Chris Seto on 17 June 2011 - 12:34 PM

You may want to try a SMPS depending on how much current you need to source.... A 7805 will heat up quite a lot under such conditions...


#14356 Power Netduino (Linksys WRT-54Gl)

Posted by Chris Seto on 15 June 2011 - 06:26 PM

Yep, you should be fine doing this.just make sure polarity is correct on the vin pin.


#13829 C# Coding standards

Posted by Chris Seto on 31 May 2011 - 06:21 PM

Frame work design guidelines. Buy it. /end of thread


#11230 Servos and batteries

Posted by Chris Seto on 23 March 2011 - 10:12 PM

"Use a separate 5V regulator to drive the servos. (Not got one to hand right now.)" That's the best option. Servos can pull more current than the Mini's Vregs are suppose to handle. Also, 9V is _much_ too high to be feeding into servo Vin. You want 4.8V to 6V maximum, unless otherwise specified.


#9640 Controlling 4-Wire PWM Fan

Posted by Chris Seto on 16 February 2011 - 07:07 PM

I didn't read the datasheet complelty, but my guess is that 1 pin is power (+12V) on pin is GND, one pin is TACH, and the last pin is the PWM pin, which goes to a transistor which allows/cuts power to the fan. Basically, I'll bet you can leave TACH floating (unless that's the process variable in your loop), GNd -> GND, +12 or whatever to +12, and then hook the Netduino's PWM pin to PWM on the fan.


#3628 Advice needed for project

Posted by Chris Seto on 07 October 2010 - 04:09 PM

No Problem :) What you are wanting to do is pretty simple. The GPS will be the hardest part, and that will just be looking around for a driver that will work. There is a thread around here started by Crispin with a pretty good looking GPS driver. You might check that out.


#978 Netduino ESC driver

Posted by Chris Seto on 21 August 2010 - 04:11 PM

This is a VERY thoroughly tested electric speed controller driver for the Netduino. Right now, it supports Traxxas ESCs only, but you can add support for other ones by making your own config class. Please note, this is meant for hobby grade RC ESCs, not for anything industrial, which may have a completely different signaling system :)

Driver:
/*
 * Electric Speed Controller NETMF Driver
 *	Coded by Chris Seto August 2010
 *	<chris@chrisseto.com> 
 *	
 * Use this code for whatever you want. Modify it, redistribute it, I don't care.
 * I do ask that you please keep this header intact, however.
 * If you modfy the driver, please include your contribution below:
 * 
 * Chris Seto: Inital release (1.0)
 * Chris Seto: Second release (1.1)
 * Chris Seto: Third release (1.2) 
 * Chris Seto: Netduino port (1.2 -> Netduino)
 * 
 * */

using System.Threading;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;

namespace ElectricSpeedController_API
{
	// This is the parent clas that will hold speed controller settings
	public abstract class SpeedControllers
	{
		// Timing range
		public abstract int[] range
		{
			get;
		}

		// How long to wait after setup to exit constructor
		public abstract int armPeriod
		{
			get;
		}

		// Ramp iteration timings
		public abstract int[] rampIterationPause
		{
			get;
		}
	}


	// This is the actual driver
	public class SpeedController
	{
		/// <summary>
		/// PWM handle
		/// </summary>
		private PWM esc;
		
		/// <summary>
		/// Timing ranges
		/// </summary>
		public int[] range = new int[3];
		
		/// <summary>
		/// Invert power setting
		/// </summary>
		public bool inverted = false;

		/// <summary>
		/// ESC model settings
		/// </summary>
		readonly SpeedControllers escModel;

		/// <summary>
		/// ESC drive modes
		/// </summary>
		public enum DriveModes
		{
			Reverse,
			Forward,
			FullScale,
		}

		/// <summary>
		/// Active drive mode
		/// </summary>
		public DriveModes DriveMode = DriveModes.Forward;

		/// <summary>
		/// Last known throttle setting
		/// </summary>
		private int currentThrottle = 0;

		/// <summary>
		/// 0-100% throttle setting
		/// </summary>
		public int Throttle
		{
			set
			{
				// Range checks
				if (value > 100)
					value = 100;

				if (value < 0)
					value = 0;

				// Are we inverted?
				if (inverted)
					value = 100 - value;

				// This will be filled below...
				int[] range = new int[2];
				int rampIterationPause = 0;

				// Select the drive mode
				switch (DriveMode)
				{
					// Set the pulse ranges to the after neutral segment
					case DriveModes.Forward:
						range[0] = escModel.range[1];
						range[1] = escModel.range[2];
						rampIterationPause = escModel.rampIterationPause[1];
						break;

					// Set the pulse ranges to the before neutral segment
					case DriveModes.Reverse:
						range[0] = escModel.range[1];
						range[1] = escModel.range[0];
						rampIterationPause = escModel.rampIterationPause[0];
						break;

					// Use both segments
					case DriveModes.FullScale:
						range[0] = escModel.range[0];
						range[1] = escModel.range[2];
						rampIterationPause = escModel.rampIterationPause[2];
						break;
				}

				// Step the wave up or down
				// I absolutely hate doing it this way, but really, there's no other better way. 
				if (value < currentThrottle)
				{
					for (int set = currentThrottle; set >= value; set--)
					{
						// Set the pulse
						esc.SetPulse(20000, (uint)map(set, 0, 100, range[0], range[1]));
						Thread.Sleep(rampIterationPause);
					}
				}
				else
				{
					for (int set = currentThrottle; set <= value; set++)
					{
						esc.SetPulse(20000, (uint)map(set, 0, 100, range[0], range[1]));
						Thread.Sleep(rampIterationPause);
					}
				}

				// Set the current power setting
				currentThrottle = value;
			}

			get
			{
				return currentThrottle;
			}
		}

		/// <summary>
		/// Create the PWM pin, set it low and configure 
		/// timing settings
		/// </summary>
		/// <param name="pin"></param>
		public SpeedController(Cpu.Pin pin, SpeedControllers escModel)
		{
			// Set up the PWM port
			esc = new PWM((Cpu.Pin)pin);

			// Bind the ESC settings
			this.escModel = escModel;

			// Pull the throttle all the way out
			Throttle = 0;

			// Arm the ESC
			Thread.Sleep(escModel.armPeriod);
		}

		public void Dispose()
		{
			this.disengage();
			esc.Dispose();
		}

		/// <summary>
		/// Disengage ESC.
		/// Behavior is dependant on ESC make and model.
		/// </summary>
		public void disengage()
		{
			esc.SetDutyCycle(0);
		}

		/// <summary>
		/// Used internally to map a percentage to a timing range
		/// </summary>
		/// <param name="x"></param>
		/// <param name="in_min"></param>
		/// <param name="in_max"></param>
		/// <param name="out_min"></param>
		/// <param name="out_max"></param>
		/// <returns></returns>
		private long map(int x, int in_min, int in_max, int out_min, int out_max)
		{
			return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
		}
	}
}

Config class:
/*
 * Traxxas XL5 Speed Controller settings
 *	Coded by Chris Seto August 2010
 *	<chris@chrisseto.com> 
 *	
 * Use this code for whatever you want. Modify it, redistribute it, I don't care.
 * I do ask that you please keep this header intact, however.
 * If you modfy the driver, please include your contribution below:
 * 
 * Chris Seto: Inital release (1.0)
 * Chris Seto: Bugfix: ramp iteration timings (1.1)
 * 
 * 
 * */

namespace ElectricSpeedController_API
{
	public class TRAXXAS_XL5 : SpeedControllers
	{
		/// <summary>
		/// Wave timings
		/// </summary>
		public override int[] range
		{
			get
			{
				return new int[3]
				{
					1000,
					1500,
					2000,
				};
			}
		}


		/// <summary>
		/// how long to let the ESC sit after init
		/// </summary>
		public override int armPeriod
		{
			get
			{
				return 500;
			}
		}

		/// <summary>
		/// How long to wait between ramp iterations
		/// </summary>
		public override int[] rampIterationPause
		{
			get
			{
				return new int[3]
				{
					50,
					1,
					1,
				};
			}
		}
		
	}


}

Example code:
using System.Threading;
using ElectricSpeedController_API;
using SecretLabs.NETMF.Hardware.Netduino;

namespace NetduinoESCDemo
{
	public class Program
	{
		public static void Main()
		{
			SpeedController xl5 = new SpeedController(Pins.GPIO_PIN_D9, new TRAXXAS_XL5());

			for (int i = 0; i <= 100; i++)
			{
				xl5.Throttle = i;
				Thread.Sleep(50);
			}

			xl5.Throttle = 0;

		}

	}
}



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.