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.

inxtremo's Content

There have been 32 items by inxtremo (Search limited from 05-June 23)


By content type

See this member's


Sort by                Order  

#24172 Serial communication with FTDI Breakout Reloaded V1.1

Posted by inxtremo on 13 February 2012 - 01:16 PM in Netduino Plus 2 (and Netduino Plus 1)

Hey thanks, i will try the code this evening after work. Hope it works. Greetings, Daniel



#24168 Serial communication with FTDI Breakout Reloaded V1.1

Posted by inxtremo on 13 February 2012 - 12:41 PM in Netduino Plus 2 (and Netduino Plus 1)

What is the switch on the side set for? It switches between 3.3v and 5v. If you are using it on Com1 it should be set for 3.3v.


Is switches between 3.3v and 5v, right. I have it set on 3.3v. I also tried to use Digital Port 2 and 3, but same problem there. After work i will try a code from the net that should work with an USB BUB, seen here

Maybe my code is wrong.

Greetings



#24160 Serial communication with FTDI Breakout Reloaded V1.1

Posted by inxtremo on 13 February 2012 - 07:23 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi an thanks for the answers. I tried to swapping the cables, same problem. The lower baud rate also didn´t work. I am no electronic guy, but the setup with this breakout board should work? Or have i bought the wrong hardware? Thanks and best greetings, Daniel



#24068 Serial communication with FTDI Breakout Reloaded V1.1

Posted by inxtremo on 10 February 2012 - 05:31 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi,

i bought the following breakout board and want to communicate serial with my windows application and the netudino.

I wired the RX-Port from the breakout board with Digital Pin 0 and the TX-Port with the Digital Pin 1. Gnd to Gnd. I hoped the wiring is the same like here.

When i send a send a message with SerialPort.Write("blaa"), the breakout board receives a signal, the led on the board blinks but my netduino recieves no data.

Code on Netduino:
using System.IO.Ports;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
using System.Threading;

namespace NetduinoStepperControl
{
    public class Program
    {
        static SerialPort serial;

        public static void Main()
        {
            // initialize the serial port for COM1 (using D0 & D1)
            serial = new SerialPort(SerialPorts.COM1, 115200, Parity.None, 8, StopBits.One);
            // open the serial-port, so we can send & receive data
            serial.Open();
            // add an event-handler for handling incoming data
            serial.DataReceived += new SerialDataReceivedEventHandler(serial_DataReceived);
            serial.ErrorReceived += new SerialErrorReceivedEventHandler(serial_ErrorReceived);

            // wait forever...
            Thread.Sleep(Timeout.Infinite);
        }

        static void serial_ErrorReceived(object sender, SerialErrorReceivedEventArgs e)
        {
            Debug.Print(e.ToString());
        }

        static void serial_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {

            Debug.Print("Data received");
            // create a single byte array
            byte[] bytes = new byte[1];

            // as long as there is data waiting to be read
            while (serial.BytesToRead > 0)
            {
                // read a single byte
                serial.Read(bytes, 0, bytes.Length);
                // send the same byte back
                serial.Write(bytes, 0, bytes.Length);
            }
        }
    }
}

Code in Application:
using System;
using System.IO.Ports;
using System.Threading;
using System.Text;
using System.Diagnostics;
namespace Plugin{

    [System.Serializable()]
    public class NetduinoControllerPlugin : System.MarshalByRefObject, IControllerPluginService
    {
        static SerialPort _serial;

    private String _name = "Netduino Controller Service";

        public String Name
        {
            get { return this._name; }
            set { this._name = value; }
        }

        private String _description = "foo";

        public String Description
        {
            get { return this._description; }
            set { this._description = value; }
        }

        public void Initialize()
        {
            Console.WriteLine("Initialize called");
            try
            {
                _serial = new SerialPort("COM3", 115200, Parity.None, 8, StopBits.One);
                _serial.DataReceived += new SerialDataReceivedEventHandler(_serial_DataReceived);
                _serial.ErrorReceived += new SerialErrorReceivedEventHandler(_serial_ErrorReceived);
                _serial.Open();
            }
            catch (Exception e)
            {
                System.Diagnostics.Trace.WriteLine(e);
            }

            //Thread.Sleep(Timeout.Infinite);
        }

        void _serial_ErrorReceived(object sender, SerialErrorReceivedEventArgs e)
        {
            Console.WriteLine(e.ToString());
        }

        static void _serial_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            // wait a little for the buffer to fill
            System.Threading.Thread.Sleep(100);

            // create an array for the incoming bytes
            byte[] bytes = new byte[_serial.BytesToRead];
            // read the bytes
            _serial.Read(bytes, 0, bytes.Length);
            // convert the bytes into a string
            string line = System.Text.Encoding.UTF8.GetString(bytes);

            // write the received bytes, as a string, to the console
            System.Console.WriteLine("echo: " + line);
            System.Console.WriteLine();
        }

        /// <summary>
        /// double deg, int onTime, int offTime, bool onFirst, uint repeat
        /// </summary>
        /// <param name="deg" example="180 -> 180 degree to left">0, 10, 100, 360, -360, -100, -10, 0</param>
        /// <param name="onTime" example="100 -> 100ms">0 - x</param>
        /// <param name="ofTime" example="100 -> 100ms">0 - x</param>
        /// <param name="onFirst" example="0 -> false" example="1 -> true"></param>
        /// <param name="repeat" example="1 -> repeats once">0, 1, 2, ...</param>

        public void MoveUp(int steps)
        {
            Console.WriteLine("MoveUp {0} Steps", steps);
            String msg = steps + ",1,1,1,1";
            _serial.Write(Encoding.UTF8.GetBytes(msg), 0, msg.Length);
        }


Anyone a suggestion?

Thanks and best regards,
Daniel



#23916 Controll two stepper motors via a wpf application

Posted by inxtremo on 07 February 2012 - 05:09 PM in Netduino 2 (and Netduino 1)

Hey Thanks, i will try it with the client/server model. Found some interesting topics here, now i know for which buzzwords to look. Thanks a lot. Best regards, Daniel



#23885 Controll two stepper motors via a wpf application

Posted by inxtremo on 07 February 2012 - 08:06 AM in Netduino 2 (and Netduino 1)

Hi Chris,

thanks for the answer. I write the thread in the wrong section, sorry. I have a Netduino Plus and control the movement via an webserver as you mentioned in your answer. My question, is it possible to drive the two steppers through an desktop application without deplying the application to the Netduino? A solution without client server communication?

My idea was to control the steppers over the usb connection. But i don´t know the right buzzwords to search for such a solution. The only thing i read was something about "Serial Communication". But in this thread this posibility was not build in 100%.

Thanks.



#23810 Controll two stepper motors via a wpf application

Posted by inxtremo on 05 February 2012 - 06:39 PM in Netduino 2 (and Netduino 1)

Hey guys,

im fairly new in netduino dvelopment and microcontroller, so sorry if this question may be stupid.

I want to control two stepper motors for a pan/tilt camera scenario. I have a working WPF application written in c#, where i can connect different pan/tilt cameras via a plugin system, a logitech ptz webcam as an example.
The same thing i want to do with the netduino, two easy driver shields and two stepper motors. At this time i can control the two motors via ethernet (server/client). In some tests i mentioned that there is a more or less huge delay between my commands and the execution of the motion. This delay is not the best for my work.

Originally i wanted control the steppers with easy commands from the application. I press the button "TurnLeft" and a stepper turns left as an example. In a past thread is see an answer like mine.

Is there an easy solution for this?

I hope for answers and sorry for my english.

Thanks and best regards,
Daniel




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.