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.

rharding64

Member Since 06 Dec 2012
Offline Last Active Feb 21 2016 02:19 AM
-----

Posts I've Made

In Topic: Serial Handler

19 November 2014 - 02:13 AM

hello there,

 

first off let's look at your datreceived event handler;

 

    static void serial_DataReceived(object sender, SerialDataReceivedEventArgs e)

        {
            Thread.Sleep(4000);
            while (serial.BytesToRead > 0)
            {
                bytesread = serial.BytesToRead;
                serial.Read(bytes, 0, bytes.Length) ;//bytes[] is declared earler: //static byte[] bytes = new byte[4610];
            }
            FillWorkingArrays();
        }
 
lose the Thread.sleep statement. 
//next if you are trying to parse out specific data in datareceived event handler
 
the place that you need to add the sleep statement is immediately AFTER sending to serial port.
in c# this would be
 
serialport.WriteLine("my data");
thread.sleep(300);
serialport.clearinputbuffer();
 
//now ready for next data
 
since you are using c# already anyways, it is not too hard to take file data, parse it out and push it to netduino.
that way you can lose the external file application and have your cake and eat it too, and not eat someone else's cake!
 
 
you are going to have to build a buffer, it is easiest to move the data as strings then once you push it to netduino, parse out to numbers at that end.
 
follow these steps;
 
string[] array = File.ReadAllLines(@"C:\path including your file");//this is VERY Fast file open, extract info, file close, all in one line!!!
 
the data; 111,2222 -- do you want this to be put into a lookup hash table, list<string.,string> or dictionary<string,string>? comma delimited.
or are you waiting to parse them out until you are on netduino?
 
next, you need a buffer, you can use a stack or a 256 level queue here.  , or

you can put a whole packet into queue.

 

anyhow, something for you to get started on, ask questions, have fun.

 

cheers

 

ron

 


In Topic: Adding to Cpu.Pin enumeration

06 April 2014 - 09:43 PM

hi there,

 

on investigation of ND1 and ND2, there are pins that don't have external pull up resistors.  Although these are not required, it is best design practice since the internal resistors that you switch on with; 

 

GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP; or similar 

 

are considered weak pull ups. 

 

If the final board layout had all pins with external pull ups or pull downs, then you could use the pin right away.  else, if these same pins were hard pulled to Vcc or GND this would effectively render these pins useless for anything down the road. 

 

Ron


In Topic: FTDI Basic Breakout - 5V

19 March 2014 - 05:21 AM

on the Vin, yes, you can have bus power or self power.  So when powered on the bus, Vin is disconnected because Vin comes from the PC host.  


In Topic: FTDI Basic Breakout - 5V

19 March 2014 - 01:15 AM

1.  The FTDI driver comes with both VCP and D2XX drivers.  It automatically switches between them as needed. In the past, you did have to manually indicate whether you were using VCP, and before that, the drivers were offered separately. 

 

So no need to worry about this issue. 

 

2.  connecting Vin and GROUND, -- quickly looking at the ftdi breakout schematic, i do not see a Vin line on the i/o connector. I notice that there are a few different versions of this breakout; 3.3V,  5V , and 3.3V/5.5V Arduino compatible; Since the Netduino is 5V compatible, it will work with 5V or 3.3V.  In any case, the ground should be connected to complete the circuit. 

 

3.  ballpoint driver, uninstall the ballpoint driver,   uninstall the FTDI driver, reboot and reinstall FTDI driver. plug in your module. 

 

 

Ron 


In Topic: Two Way communication

03 March 2014 - 03:29 AM

Max,

 

as many parent processes model well to a state machine, at first glance what you are trying to accomplish is sequential with dependencies involved. 

let's break down your system;

 

I need to implement a system like this:

 

1) Netduino controls a stepper.

>>are you using a ULN2003 device to control the stepper motor, just google uln2003 stepper motor and you will find many circuits like this. ULN2003 has built in diode projection for the CEMF build up in the 4 coils of a typical stepper motor. 

2) Affter some step, Netduino must notify a windows form app that the motor has finished

>>suggest that you install a sense line that tells you when the stepper motor is actually running then feed this as an input to your system. Now, you will be able to sense when motor is actually ON or OFF, not depending blindly on the control commands.  So use the sense line into digital input on Netduino.  the windows forms app listens for this line and fires an event handler in the windows forms application. 

3) The window app do some job, and after that notify Netduino.

>>that is just passing messages between a windows PC form application and the netduino application. 

 

i have been creating c# based tools and electronic interface design/build for various clients since 2006.  To have true system wide interaction with the device under test it is important to also provide device interaction via your SCPI programmable test equipment as well.  I am currently working on an OOP design pattern so i can create custom remote control applications for any SCPI capable test gear provided that i have the OEM gear programmer's reference guide PDF file.  

4) Netduino run the motor again

 

An so on.

 

the two tasks (motor stepping and the windows form app job) are very short: the motor runs for about half a second, the job consists in capturing an image from a web cam streaming and save it in a folder, so less than a second.

>>here, have you tried using the AutoResetEvent / ManualResetEvent?  

Also, there are things that you can do in winform applications to give additional information in the form of different colored prompts, i.e. red background with yellow font implies error message, navy blue background with white font means status, green background with yellow font means input, ect. 

 

 

Plus, is critical that none of the two actors fail a sigle phase.

 

I tried with Netduino Plus one, 4.2.0.1 Tried with a COM 2/COM1 communication, that failed because of the USB/RS232 cable, maybe for different voltage required by the cable (5V, i think).

 

At this point i'm stuck: must i buy a couple of breakbox or a cables for my Netduino Plus 1 and implement via rs232, or buy a Netduino Plus 2 and implement the communication with the winform app via Ethernet? It is possible a two way communication? I've tried to use Socket on ND+1, but in that case, i obtained a crash when i tried to create an instance of the output ports (4) for the stepper motor. Viceversa, if the output ports are already created, i cannot create a Socket.

>>here, don't waste your money!  I have been using FTDI chips in c# for years. They have an unmanaged API for years, but now they have a c# wrapper api as well. FTDI now offers up to 4 ports that can be mapped into 4 VCP, or USB based individually.(FT4232) you can also get a two port device as well, the FT2232.  A partner company DLPdesigns makes the pcb dev boards that can be mounted on breadboard. they are very easy to set up and use. since there is a pretty large user base, many good examples out there for use. so,

so offerings by dlp designs; 

 

two port model; 

http://www.dlpdesign...usb/2232h.shtml

 

4 port model;

see FTDI page on chip

http://www.ftdichip....ICs/FT4232H.htm

see evaluation board offered;

http://www.ftdichip....Mini_Module.pdf

 

So, going forward, well these items work in your application?

 

cheers

 

Ron 

Santa Clara, CA

 

 

if you want to 

 

Plus i think that with the COM1/COM2 solution i have to make 2 usb ports busy, plus a thord for the webcam. Too much cables and also i don't know if the communication is enough robust.


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.