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.

Bendage

Member Since 17 Nov 2011
Offline Last Active Sep 20 2016 11:31 PM
-----

#42309 NeonMika.Webserver

Posted by Bendage on 27 December 2012 - 11:02 PM

Chris,
FYI I had the same mercer problem explained here Blue screen.
I first suspected was my pc, but I tried at least 5 times and had always the same result using this web server project. After reflashing the board, I tested may other
project with no problem, as soon as I start this web server everything hangs.
Moreover, trying to detach the USB cable during VS hang, blue screen appears, while terminating VS first and then detach the board no blue screen appear, and I only have to
reflash the board.

Hope this could help you
Gerardo

Hey Gerardo,

 

Never unplug the USB cable while VS is deploying. The BSOD is sure to follow. There is an option to cancel deployment under View/Toolbars/Build

 

Always use this and DO NOT unplug the board. I realize this does not fix the issue that the 3 of us cannot reproduce but there is definitely an issue I can vouch for. Since I just got my N+2 today it will take me a bit of time to figure out whats going on.


  • JJJ likes this


#42308 NeonMika.Webserver

Posted by Bendage on 27 December 2012 - 10:56 PM

Chris, it's difficult to share the code, because VS hangs, the board hangs, the result in th debug window exactly the same of Mercer one. I'm using N2+ with 4.2.1.2 Today i was testing even the netmftoolbox-20443 basic speaker sample, and i had the same result: VS and the board hang. VS must be terminated, and the board must be reflashed. Thank you, and I want to thank you for N2+, absolutely a great project! Gerardo

 

I had the same problem. Flashed my board twice! Daves build works plus the bug fix I posted. Runs fine.




#42305 NeonMika.Webserver

Posted by Bendage on 27 December 2012 - 10:51 PM

Ok, I have successfully got this running on N+2 but there is a bug in the socket code that causes the web server to drop the client about 3 out of 5 requests.Here is where the bug is under the server.cs...

 

The problem is that when the socket connects there are not bytes yet in the buffer. If the byte count is 0 he breaks out which causes the client browser to receive a dropped connection. This can be fixed by inserting a thread.sleep(100) up a few lines. Once this sleep is placed initially before the first byte check, the buffer has enough time to start populating. I have commented where the thread.sleep needs to be Fix that and this thing purrs.

 

Very nice web server. TONS of functionality.

private void WaitingForRequest( )        {            while ( true )            {                try                {                    using ( Socket clientSocket = _ListeningSocket.Accept( ) )                    {                        // Add the Thread.Sleep(100) Here                         int availableBytes = 0;                        int newAvBytes;                        //if not all incoming bytes were received by the socket                        do                        {                                                       newAvBytes = clientSocket.Available - availableBytes;                            if ( newAvBytes == 0 )                                break;                            availableBytes += newAvBytes;                            newAvBytes = 0;                            Thread.Sleep(1);                        } while ( true );                        if ( availableBytes > 0 )                        {                            byte[] buffer = new byte[availableBytes > Settings.MAX_REQUESTSIZE ? Settings.MAX_REQUESTSIZE : availableBytes];                            byte[] header = new byte[0];                            int readByteCount = clientSocket.Receive(buffer, buffer.Length, SocketFlags.None);                            for ( int headerend = 0; headerend < buffer.Length - 3; headerend++ )                            {                                if ( buffer[headerend] == 'r' && buffer[headerend + 1] == 'n' && buffer[headerend + 2] == 'r' && buffer[headerend + 3] == 'n' )                                {                                    header = new byte[headerend + 4];                                    Array.Copy(buffer, 0, header, 0, headerend + 4);                                    break;                                }                            }                            //reqeust created, checking the response possibilities                            using ( Request tempRequest = new Request(Encoding.UTF8.GetChars(header), clientSocket) )                            {                                Debug.Print("... Client connected ... URL: " + tempRequest.URL + " ... Final byte count: " + availableBytes);                                if ( tempRequest.Method == "POST" )                                {                                    //POST was incoming, it will be saved to SD card at Settings.POST_TEMP_PATH                                    PostToSdWriter post = new PostToSdWriter(tempRequest, buffer, header.Length);                                    post.Receive( );                                }                                //Let's check if we have to take some action or if it is a file-response                                 HandleGETResponses(tempRequest);                            }                            Debug.Print("Client loop finished");                            try                            {                                //Close client, otherwise the browser / client won't work properly                                clientSocket.Close( );                            }                            catch ( Exception ex )                            {                                Debug.Print(ex.ToString( ));                            }                        }                    }                }                catch ( Exception ex )                {                    Debug.Print(ex.Message);                }            }        }



#36223 Netduino Console

Posted by Bendage on 29 September 2012 - 01:48 AM

After a year of development on my free time I'd like to present Netduino Console.

A dynamic plugin interface with a built in messaging layer for you to create control plugins that send and receive events to and from the Netduino Controller.

You can find the source code at https://netduinoconsole.codeplex.com

Linked is a quick demonstration of some of the capabilities of what the Netduino Console can do.

Feedback and questions are welcome.

Enjoy!

http://www.youtube.com/watch?v=nxBPoAudAKA&feature=channel&list=UL

Posted Image


#35442 Electronic Speed Control question

Posted by Bendage on 18 September 2012 - 02:48 AM

Hi, My background is code and not electronics but this is probably a simple question for most of you... I am controlling a DC motor via PWM and a force sensor via Analog input. I map the 0 - 1023 values of the force sensor to a duty cycle of 0 - 100 for the PWM pin. It works fine. Using a multimeter I can see 0 - 3.3v coming out of the PWM as I squeeze the sensor but the motor doesn't move. If I hook the motor directly to a variable power supply it runs just fine on 3.3v. Is there not enough current drawing from the PWM pin or what? If I juice the motor from a different power source how can I make the voltage vary? I'm assuming I need to use an ESC. So if I power the motor via 9v and only want 3.3v do I just set the PWM duty cycle to around 33 for max voltage? If an ESC is what I need are there any recommendations?


#33231 GY-85 9 DOF IMU Sensor

Posted by Bendage on 07 August 2012 - 04:44 PM

Hey Everyone,

Anybody have any experience with this board? Bought one from Ebay without realizing it uses I2C, and for the life of me I can't find a PDF on the specs which would include addresses for each of the 3 chipsets.

Thanks!

Posted Image


#27177 Serial Data Transfer Protocol problem

Posted by Bendage on 13 April 2012 - 08:00 PM

I have been working on a universal serial protocol for quite some time now between the PC and Netduino that allows me to create plugin libraries that snap into a console app so I can dynamically plug in different components to work on the fly and not have to create from scratch every time.

So the console works wonderful and I can load dll's onto the SD card and send messages to the controller to load the dlls depending on what library I have made for each component I want to work with. Each controller library communicates in sync with a dynamic Windows user control to exchange events and values through the protocol and as a developer I no longer have to worry about the communication part and now can just create controls and snap them in on the fly depending on what I want the Netduino to control. So in theory I can control the Netduino from a windows app any way I want or control the windows app from the Netduino any way I want without knowing anything about the message layer.

Here is the problem. I got a bit cocky in that I got tired of compiling a Micro Framework dll and pulling the sd card loading the dll and resetting the netduino. So I decided to add streaming into the serial protocol that will send the dll file through serial and auto save to sd card and then load.

The main problem is since this is a protocol that has many message types once entering into a stream mode, since any byte in the file can represent 0 to 255 I no longer have a message terminator to let me know when I have sent the last byte of the file.

How to I tell my data received event I am done sending any byte 0 - 255? What kind of message End of Transmission can I use if binary data uses all of them?

I tried looking at the way the FTP protocol works to see if that would help but FTP sends a binary stream on a separate port from the one it actually exchanges messages. I do not want to use two different com ports with FTDI connections. There has got to be a better way.

Posted Image


#25588 PWM Pin Breakdown

Posted by Bendage on 16 March 2012 - 03:47 AM

Nicely done Mario! Nicely done! And thanks for the links CW2 and Paul! Hope you guys aren't getting irritated. I am the type of person that when I get into something, I like to master it. There are 100 guys on here that are just like me. I'm just the only one who does not care to show how stupid I am by asking B) How else you gonna learn? A lot of this knowledge is held in the heads of those who own an oscilloscope and a logic analyzer. Some day soon!


#25357 Getting started with I2C

Posted by Bendage on 11 March 2012 - 04:05 AM

Can someone give a thorough definition of exactly how the I2C interface works and how to use it on the Netduino? I think many of us micro controller newbs know what it is but don't understand whats going on. I know many components use this interface but what is really happening and how can we use it? A perfect example what be an explanation of the LCD I2C 1602 screen. Whats going on step by step? Thank you.


#25356 Getting started with SPI

Posted by Bendage on 11 March 2012 - 04:00 AM

About all I know of SPI are the pins used and a needed cable select pin per component to be interfaced. What I do not know is how it works in layman's terms. 1. How to use the SPCK clock pin. How does it work? I know it controls the rate at which messages should be sent but what is really happening? 2. What does it mean to send data on the rising/falling edge? 3. How do bytes get sent over the MISO and MOSI pins? What is really happening? How does it work? 4. How to FULLY use the SPI and SPIConfig classes in the Micro Framework to their full potential? 5. What is "Bit Banging" and what is really happening? Can you use other pins? 6. What is the difference in using these classes opposed to "Bit Banging" to interface with SPI? Maybe give a simple real world example of a scenario on how/when to use it. Thank you.


#25355 PWM Pin Breakdown

Posted by Bendage on 11 March 2012 - 03:49 AM

Can anyone fully explain the PWM pin in retrospect to the Netduino board and Micro Framework. 1. How do they work? Whats going on behind the scenes. 2. How to access them to their full (hack) potential and manipulate them with the Micro Framework? 3. What are the definitions of the SetPulse parameters and how does it equate to Mhz conversion? Max/min values and how they equate? 4. What is SetDutyCycle and how does is relate and how can I use it? Maybe give a thorough example of how it controls a servo and what is really happening behind the scenes. Thank you.


#25247 Powering EasyDriver Question

Posted by Bendage on 08 March 2012 - 06:00 PM

Forgive the obvious. That power supply was delivered to you pre-assembled. You tested it after you built it right? You got a cordless drill battery laying around?


#25244 Powering EasyDriver Question

Posted by Bendage on 08 March 2012 - 05:34 PM

Also, the link you show on outlet is 5v regulated. I can power one motor off 5v but not 2. You seriously got N+ to power 2 Nema 17's off the board?


#25243 Powering EasyDriver Question

Posted by Bendage on 08 March 2012 - 05:31 PM

Keep staring at your diagram. Seems right. The only thing is that you show the pic powering from your board, not power supply. Are you sure the power supply is grounded to the Netduino board?


#25240 Powering EasyDriver Question

Posted by Bendage on 08 March 2012 - 05:01 PM

Hmmm, Interesting. Can we have a look at your code for sanity sake? Maybe its your delay between steps?




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.