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.
Photo

Running an interactive console on a NETMF device


  • Please log in to reply
16 replies to this topic

#1 Niels R.

Niels R.

    Member

  • Members
  • PipPip
  • 28 posts

Posted 06 June 2012 - 09:35 AM

Hi, I think I came across a blogpost (or similar) about this months ago, but I can't seem to find it anymore. So I'm hoping to gather some info through this forum. As I'm currently working on a monitoring device that will sit in my cellar I want to be able to communicate to the device through my LAN. This communication can be necessary to read statistics or modify the configuration of the app running on it. I suppose there are multiple ways to do this and I was wondering if anyone here has done this before. I'm not looking for ready-to-roll source code, but only for patterns and ways to implement this to get myself started. Kind regards, Niels R.

#2 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 06 June 2012 - 09:54 AM

Hi Niels, I haven't seen anything like that so far, but I've been thinking of making something simular myself. I could try to put it higher on my todo list :)
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#3 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 06 June 2012 - 09:55 AM

As I'm currently working on a monitoring device that will sit in my cellar I want to be able to communicate to the device through my LAN. This communication can be necessary to read statistics or modify the configuration of the app running on it.

I suppose there are multiple ways to do this and I was wondering if anyone here has done this before.


Search the Project Forums for web servers.

If you are interested I wrote a Silverlight client which communicated with a web server on the N+. You caould easily modify this to write configuration parameters to and SD card so they survive resets.

Hope this helps,
Mark

To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#4 Niels R.

Niels R.

    Member

  • Members
  • PipPip
  • 28 posts

Posted 06 June 2012 - 09:58 AM

Search the Project Forums for web servers.

If you are interested I wrote a Silverlight client which communicated with a web server on the N+. You caould easily modify this to write configuration parameters to and SD card so they survive resets.

Hope this helps,
Mark


Hi Mark,

Thanks for the info. I was indeed thinking about a web server as a possibility. Although a "terminal" service would be cool too (using a prompt to give commands).

Cheers,
Niels R.

#5 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 06 June 2012 - 10:03 AM

Thanks for the info. I was indeed thinking about a web server as a possibility. Although a "terminal" service would be cool too (using a prompt to give commands).

I think the memory restrictions on the N+ make things like that difficult.

I suppose you could investigate sockets on the N+ as an alternative. You will have to write your own parsing on the N+ and as memory is at a premium this could get expensive. The web server route allows you to control the data sent between the client and the server. You can pass the burden of parsing to the PC which should have the power to ensure only good data is sent to the N+.

Regards,
Mark

To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#6 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 06 June 2012 - 10:08 AM

I think the memory restrictions on the N+ make things like that

Why is that? My guess would be it would actually be way lighter then a webserver. Now I know for sure, I'm going to dive into this :lol:
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#7 emg

emg

    Advanced Member

  • Members
  • PipPipPip
  • 129 posts

Posted 06 June 2012 - 12:15 PM

How much data is passed to/from the device? I've got a ND+ running a pump and taking 3 temp/1 light readings. I've arranged 2 'comms' threads using 2 different sockets/ports, one send, one receive. I send simple text string commands and receive single lines of text that I parse at the PC end (temp logs, command results, etc). Each end uses a simple queue collection to buffer data. I have another thread that reads the queue of commands and acts on them (turns pump on/off, set new config, reboots, etc). Simples.

#8 Niels R.

Niels R.

    Member

  • Members
  • PipPip
  • 28 posts

Posted 06 June 2012 - 12:24 PM

How much data is passed to/from the device? I've got a ND+ running a pump and taking 3 temp/1 light readings. I've arranged 2 'comms' threads using 2 different sockets/ports, one send, one receive. I send simple text string commands and receive single lines of text that I parse at the PC end (temp logs, command results, etc). Each end uses a simple queue collection to buffer data. I have another thread that reads the queue of commands and acts on them (turns pump on/off, set new config, reboots, etc). Simples.

Hi emg,

The monitoring and logging logic is decoupled from the console interface. The console interface would be used to interactively query the device and change configuration settings.

Since I've asked my initial question I've worked out an idea in my head, but I've to get some stuff sorted before I can start implementing.

Cheers,
Niels

#9 Coding Smackdown

Coding Smackdown

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationLewisville, TX USA

Posted 06 June 2012 - 01:18 PM

I have a Temperature Monitoring Project out on codeplex that I put together for my Walk-In Beer Cooler. It might be a good start for what you want. You can find the code at http://diybrewerytem...r.codeplex.com/ Hope this helps you out.
Brewing Award Winning Beer with a Netduino!
http://diybrewery.com

#10 Niels R.

Niels R.

    Member

  • Members
  • PipPip
  • 28 posts

Posted 06 June 2012 - 01:21 PM

I have a Temperature Monitoring Project out on codeplex that I put together for my Walk-In Beer Cooler. It might be a good start for what you want.

You can find the code at http://diybrewerytem...r.codeplex.com/

Hope this helps you out.

Thanks for the offer, but I already have most of the software written. It happens that I'm writing a monitoring/controlling device for our home brewery to keep track of (and control) the fermentation process.

Cheers,
Niels R.

#11 nakchak

nakchak

    Advanced Member

  • Members
  • PipPipPip
  • 404 posts
  • LocationBristol, UK

Posted 06 June 2012 - 02:44 PM

I would have thought it should be pretty easy to implement, create a socket listener, possibly return some welcome message on connect and possibly create a parser if you plan on having sub verbs, if you only ever want to deal with key value data (verb payload) all you would need is a switch statement. I assume you want a telnet style interface, using a telnet client like putty of the built in terminal under your OS of choice? If so this will probably give you a nudge in the right direction http://www.switchont...aded-tcp-server Would be pretty cool to have a standard telnet implementation for console config on the ND platform

#12 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 06 June 2012 - 04:43 PM

If you want to do it perfectly, with full telnet support, you need more then just a socket. ANSI could help with coloring, locating the cursor, clearing the terminal's screen, but it's also useful to know the size of the terminal, and to enable and disable local echoing. So when using sockets, also add a telnet protocol layer. and above that, an ANSI layer would be nice.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#13 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 06 June 2012 - 09:40 PM

Is this kinda of what you had in mind? Attached File  not_pushed.png   27.96KB   81 downloads Attached File  pushed.png   27.11KB   79 downloads For the telnet I read http://www.networkso...ocol/telnet.htm For ANSI color coding I read http://isthe.com/cho...si_escapes.html
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#14 nakchak

nakchak

    Advanced Member

  • Members
  • PipPipPip
  • 404 posts
  • LocationBristol, UK

Posted 07 June 2012 - 09:04 AM

Nice work Stefan!

I fully agree for a full experience you would want to implement telnet, how ever a lot of devices i work with simply stream a serial ascii text via a socket and or a serial link, for maximum configurability i.e. not every device is patched into a network so an engineer with a laptop is sent to the remote device for configuration.

I wonder if you could get telnet star wars running off a ND+? Would be pretty sweet albeit quite pointless...

#15 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 07 June 2012 - 09:18 AM

I wonder if you could get telnet star wars running off a ND+? Would be pretty sweet albeit quite pointless...

It will be possible I suppose. It's just sending some ASCII back.

I will work out my lib a bit more this week and hope to publish source code by the end of the week.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#16 Charles

Charles

    Advanced Member

  • Members
  • PipPipPip
  • 192 posts

Posted 09 June 2012 - 03:56 PM

I wrote the code you are looking for over a year ago... It is open source. Check out this thread. http://forums.netdui...et-server-rev-2 It has the Telnet protocol implemented, complete with listeners and socket setup. It is configured as a basic command prompt in the source code. The code is well documented and you should be able to alter it to suit your needs without much trouble.

#17 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 09 June 2012 - 04:02 PM

I wrote the code you are looking for over a year ago... It is open source. Check out this thread.

http://forums.netdui...et-server-rev-2

It has the Telnet protocol implemented, complete with listeners and socket setup. It is configured as a basic command prompt in the source code.

The code is well documented and you should be able to alter it to suit your needs without much trouble.

Darn, I have completed such a thing last week, I should have known this :)

Attached File  shell.png   61.87KB   29 downloads

Haven't looked at your code yet, but did you also encounter this problem? http://forums.netdui...055-wsaenobufs/
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

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.