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.

nhale

Member Since 17 May 2012
Offline Last Active Apr 23 2014 03:27 PM
-----

Topics I've Started

SerialPort buffer overflow on Netduino 2

23 March 2014 - 10:21 PM

So I nailed it down why my N2 does not work since I got it last year. Now I upgraded again and still did not work.

The problem is that the same code below runs on the N1 and N1+ without any problem, but on N2 and N2+ nothing works.

When starting MFDeploy after deploying the code to the N2(+), the console shows an endless list of "Buffer overflw" messages. Again on N1(+) it's running for hours without any problem.

 

Please advice what's wrong here...because it's still an issue in 4.3.1

There is just an Adafruit Ultimate GPS sensor v3 connected to the N2 nothing else

public class Program
    {
        public static void Main()
        {
            //Required, otherwise redeploy not possible due to Buffer overflow
            Thread.Sleep(8000);

            GpsConnector _gpsConnector = new GpsConnector();

            Thread.Sleep(Timeout.Infinite);
        }
    }

    public class GpsConnector
    {
        SerialPort _serialPort;
        private char[] splitBy = new Char[] {'\r', '\n'};
        private bool _isStarted;
        
        //'objectified' main		
        public GpsConnector()
        {		
            _serialPort = new SerialPort("COM2", 115200, Parity.None, 8, StopBits.One);
            _serialPort.Handshake = Handshake.None;
            		
            _serialPort.Open();
            if (_serialPort.IsOpen)
            {
                _isStarted = true;
                DoProcessing();
            }
        }

        private void DoProcessing()
        {           
            if (!_serialPort.IsOpen)
            {
                _serialPort.Open();
            }

            while (_isStarted)
            {
                int bytesToRead = _serialPort.BytesToRead;
                // get the waiting data
                byte[] buffer = new byte[bytesToRead];
                _serialPort.Read(buffer, 0, buffer.Length);
                _serialPort.Flush();
                //only accept a statement starting with $
                if (buffer[0] != 36)
                    continue;

                //copy the byte array to a readable string
                String str = new String(System.Text.Encoding.UTF8.GetChars(buffer));

                //break up string into statements
                string[] statements = null;
                statements = str.Split(splitBy);

                for (int i = 0; i < statements.Length; i++)
                {
                    //only accept statements with a checksum
                    String currStatement = statements[i];
                    if (currStatement.Length > 0 && currStatement.IndexOf("*") >= 0)
                    {
                        Debug.Print(currStatement);
                    }
                }
            }
        }
    }

Read data from CAN-Bus using ELM327

23 March 2014 - 10:20 AM

Hi,

 

I bought a Sparkfun OBD-UART II board and I'm able to read data from the OBD interface.

Now I need some additional data from the CAN-Bus which is not accessible via an OBD code.

 

Regarding to the spec of the ELM327 there are some commands related to CAN, but I don't really get the idea of how to read a value for a specific CAN-Id...

 

Maybe someone already did something in this direction and may help me out how to do this.

For example I found this site with a CAN-Id and the description how the value is formatted:

http://www.loopybunn...PC/can/0CE.html

 

I found some topics regarding some "MCPC2515" but I think that's different to the ELM327, or is the procedure the same (when leaving out that one works with SPI and the other UART)

 

Thanks in advance


Connect Push-Button to Analog-Pins

10 September 2013 - 10:01 AM

Hi,

 

as my digital pins are nearly all in use, I asked myself if there is a possibility to connect a pushbutton like this one (http://www.conrad.co...product/706140/) [font="arial, helvetica, sans-serif;"]to the Analog pins?[/font]

 

Is this possible via the analog pins and if yes, is there some kind of tutorial how to do it with the analog pins?

Is there some restriction in the cable length between button and pin? Do I need additional resistors or something like that? (sorry I'm no electronics guy ;-))

 

Thanks in advance.


Community Netduino case ?!

28 May 2013 - 10:32 AM

Hi,

I know there are some topics about the "case" topic, but my intention is a little bit different.
Let me explain.

I bought a case from an electronics supplier, which is not specifically made for a netduino or arduino. For my prototype it works fine, but now I'm searching for a case which fit's to some of my needs.
1.) What I found was the e.g. the duinoCase-NP which looks nice, but is too small for my needs. And btw. is not available in Germany ;-(
2.) Others I found are made of thin plastic, which might break when used in rough/harsh environments.

3.) A self-made case would be the ideal way, but might be very costly for just 2-3 units. On the other hand I'm not good at CAD or whatever the manufacturer requires.

 

As this is a community, isn't there a way that we build an extendable case which can be used for several use-case - together?

 

As several cases only work for the Netduino itself or maximum 1 shield, most cases don't work if you are using 2 or more shields. On the other hand in most cases they are so small, that even adding some additional wires and plugs is very hard or impossible.

 

------ IDEA -----


    [*]Build a case which can be stacked, like the shields do. Take a look at this one from thingiverse. That's somehow the groundplate, which contains the Netduino and how it could look like.
    [*]Additionally there could be some extension units, like 19" cases, in different heights which can be mounted on top (1 height for 1 shield, 2 heights for two shields etc.)
    [*]And then there is another cover on top. That's it...
    [*]To make it usable for different scenarios, some space on the side and back to be able to add additional stuff inside (cables, plugs)
    [*]If it's made of plastic, everybody can drill an additional hole.
    [/list]

     

    As an example what I mean with space for additional plugs and wires, I attached the current version of my project. There you see the height of 2 shields and that there is little space left.

    I just need some connectors which are reliable when it comes to vibrations and movement. Additionally there are two more connectors planned and 3 LED's.

     

    What do you think, anyone good at CAD or knows someone who can built it using injection molding or similar...

    Additional ideas are also welcome. Maybe describe what are your special needs and how do you think they could be solved generically?

     

    Maybe also SecretLabs could produce and sell it ;-)


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.