Servo Controller GO Module
#1
Posted 03 October 2012 - 12:14 PM
#2
Posted 03 October 2012 - 01:00 PM
--
Asbjørn
#3
Posted 03 October 2012 - 01:21 PM
And Adafruit have an i2c based one: https://www.adafruit.com/products/815
That might be easier than the Parallax one. Using the parallax controller I would have to figure out how to "emulate" a serial controller on the Netduino.
#4
Posted 03 October 2012 - 01:52 PM
--
Asbjørn
#5
Posted 03 October 2012 - 02:14 PM
The only problem right now is the i2c part, it's not available yet, but coming on the shieldbase someday, only the (well, rather expensive) DAQ from Nwazet you have i2c.
atleast, i think those are the only i2c options right now.
Do you have any idea how to emulate a serial port on the netduino to send commands at a certain baud rate to another device? I'm slowly researching this but curious if anyone else has attempted it.
#6
Posted 03 October 2012 - 02:37 PM
--
Asbjørn
#7
Posted 03 October 2012 - 02:43 PM
Do you have any idea how to emulate a serial port on the netduino to send commands at a certain baud rate to another device? I'm slowly researching this but curious if anyone else has attempted it.
Serial communication is well established on the original Netduino and Netduino Plus and is a common way of getting debug information out to a dumb terminal.
The code below might work for you (I pulled it out of one of my projects) but your solution does not have to be this complex. There are also several threads on 'Netduino serial communication' (with various levels of complexity) here in the forums. If you have any trouble making progress, I'll try to help.
public class SerialPort : IDisposable { private System.IO.Ports.SerialPort _serialPort; public static string NewLine { get { return "\r\n"; } } public SerialPort() : this(SerialPorts.COM1) { } public SerialPort(string portName) { _serialPort = new System.IO.Ports.SerialPort(portName, 9600, Parity.None, 8, StopBits.One); _serialPort.Open(); _serialPort.DataReceived += OnDataReceived; Thread.Sleep(50); _serialPort.Write(Encoding.UTF8.GetBytes("\r"), 0, "\r".Length); } public System.IO.Ports.SerialPort Native { get { return _serialPort; } } public void Dispose() { _serialPort.Dispose(); _serialPort = null; } public event DataReceivedHandler DataReceived; private void OnDataReceived(object sender, SerialDataReceivedEventArgs e) { var port = sender as System.IO.Ports.SerialPort; if (port == null) { return; } DataReceivedHandler handler = DataReceived; if (handler == null) { return; } var buffer = new byte[port.BytesToRead]; int numBytesRead = port.Read(buffer, 0, port.BytesToRead); if (numBytesRead <= 0) { return; } var message = new string(Encoding.UTF8.GetChars(buffer)); handler(new DataReceivedEventArgs(message)); } public virtual void Write(byte[] bytes) { _serialPort.Write(bytes, 0, bytes.Length); } public virtual void Write(string message) { Write(Encoding.UTF8.GetBytes(message)); } public virtual void WriteLine(string message) { Write(message); Write(NewLine); } }
- TechnoGuy likes this
#8
Posted 03 October 2012 - 04:12 PM
#9
Posted 03 October 2012 - 04:51 PM
Yes, you can expose a PWM on a GoBus module as virtual I/O. You can then control the PWM on the module as if it were a PWM on your mainboard.From my understanding of Go Modules you have a uC at the other end anyway so surely its possible to send a command on the GoBus that then "orders" the uC's UART to operate the servo driver. Noob here so maybe wrong.
This is how the Shield Base works today.
Chris
#10
Posted 03 October 2012 - 04:55 PM
Yes, you can expose a PWM on a GoBus module as virtual I/O. You can then control the PWM on the module as if it were a PWM on your mainboard.
This is how the Shield Base works today.
Chris
Thanks! This is a Shield Base that will be connecting to the Parallax Server Controller that I referenced in my first post. I was just curious if I could send certain 8 byte commands to the controller from the Shield Base Go Module. Are the Virtual I/O classes/methods documented anywhere so I can study them?
#11
Posted 03 October 2012 - 05:16 PM
The Virtual I/O classes/methods are the standard classes/methods. You use OutputPort, AnalogInput, PWM, etc. just like normal. You just need to specify the correct virtualized pin (shieldBase.Pins, shieldBase.AnalogChannels, shieldBase.PWMChannels, etc.).Thanks! This is a Shield Base that will be connecting to the Parallax Server Controller that I referenced in my first post. I was just curious if I could send certain 8 byte commands to the controller from the Shield Base Go Module. Are the Virtual I/O classes/methods documented anywhere so I can study them?
We're testing virtualized SerialPort for Shield Base this week. I should be posting an update which enables 2-3 UARTs on Shield Base by next weekend. Then we just have SPI and I2C to go.
Chris
- Gutworks and QuantumPhysGuy like this
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users