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

[ask] serial camera + gprs shield + netduino


  • Please log in to reply
17 replies to this topic

#1 gXpratama

gXpratama

    New Member

  • Members
  • Pip
  • 2 posts

Posted 18 August 2010 - 04:37 AM

Hi all, I'm new in the forum and to netduino too. Seems promising and more beautiful than arduino I think.

I've a plan to build a monitoring system that involves a jpg serial camera (LS-Y201) and a gsm/gprs shield for arduino (SM 5100). However, I've been told somewhere that duemilanove might not fast enough to be able to stream the jpg data from the camera to the gprs shield (due too low buffer and only 16MHz).

Since then I started to look for a more powerful alternative and luckily I stumbled upon netduino. So here's the questions: Will netduino be able to get the job done? If so, where should I start? (I'm just a seasonal arduino user too actually, be gentle with me :)). Is there any drivers that's not available yet to build the project?

Sorry if I have so much to ask. Thanks a lot before.

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 18 August 2010 - 05:46 PM

Hi gXpratama, We haven't done any image or image speed tests yet, so I'm not totally sure on the speed question. It would be really cool to put one together and see what happened. The other issue right now is that you're going to need C# drivers for the GPRS shield. There might be some code for .NET MF out there already, but we may need to put that together as a community... Thanks for your post, and welcome to the online Netduino community! Chris

#3 gXpratama

gXpratama

    New Member

  • Members
  • Pip
  • 2 posts

Posted 19 August 2010 - 07:02 AM

Hi Chris, thanks for the reply. Well then, I'm a bit reluctant to try it out on the real hardware since this is also my first encounter with C#. I think I'm just gonna wait and see how it turns out in a few weeks. I'll try to search for more infos (and knowledge in C#) in the meantime. Thanks again!

#4 dropsofjupiter89

dropsofjupiter89

    Member

  • Members
  • PipPip
  • 15 posts

Posted 08 February 2011 - 07:14 AM

Hi everyone,

I just wanted to let you all know that I am going to interface a 4Dsystem's ucam (TTL version) with the Netduino. I got it to work on the Arduino Nano board, however, it was too slow (2-4 seconds of serial communication for a single JPEG image). So I will now attempt it on the Netduino. I hope to share the code with all of you once I am done (in about 1 to 2 weeks). I hope all of you can help me out along the way with questions I may have in the future.

To start, I have a very basic question about the .Net Framework. I read this the following in another forum:

The #1 disadvantage for these .Net Micro Framework devices is response times. It's running interpreted byte-code (it's .Net after all), not native C code, so there is about an order of magnitude more latency (1-3ms vs 1-3us) in the response times.

What is he/she trying to say? What is that 1-3ms latency represent? I am so confused. Thank you,

Here is the link to the 4dSystem's ucam data sheet if you are interested:
http://www.4dsystems...CAM-DS-rev4.pdf

#5 dropsofjupiter89

dropsofjupiter89

    Member

  • Members
  • PipPip
  • 15 posts

Posted 12 February 2011 - 12:13 AM

How do I access the Netduino Libraries. For example, I right click on "OutputPort" and click on "go to Definition" and I get the definition of the class including the constructors and functions. However, I want to see what happens in the constructor of "OutputPort" or "OutputPort.Write" for example. Please push me in the right direction.

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 12 February 2011 - 04:40 AM

Hi dropsofjupiter89,

You can find the source on the downloads page. You'll want the .NET MF 4.1 Source.

In particular, check out the following files:
C:\MicroFrameworkPK_v4_1\Framework\Core\Native_Hardware\IOPorts.cs
C:\MicroFrameworkPK_v4_1\CLR\Libraries\SPOT_Hardware\spot_hardware_native_Microsoft_SPOT_Hardware_OutputPort.cpp

Chris

#7 Nevyn

Nevyn

    Advanced Member

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

Posted 12 February 2011 - 07:41 AM

What is he/she trying to say? What is that 1-3ms latency represent? I am so confused. Thank you,

I think the point which is being made is that every byte code in .NET has to be translated and this takes time because the translation process itself consumes CPU cycles.

What would be interesting to know is how this is done in the micro framework. Does anyone know
  • Are the instructions interpreted as they are executed (i.e. do they have to be translated each time they are executed) OR
  • Is the program translated to native code in it's entirety at start and the native code run

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


#8 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 12 February 2011 - 08:50 AM

Hi Nevyn, The instructions are interpreted as they are executed. If I remember right, JITted instructions would be bigger (plus you'd have to have RAM to store them in for execution). Chris

#9 dropsofjupiter89

dropsofjupiter89

    Member

  • Members
  • PipPip
  • 15 posts

Posted 13 February 2011 - 08:04 AM

Chris, Thankyou for your help. I was looking through the source trying to figure out how to increase the serial buffer limit. Right now, the Netduino (regular) has a 1024 byte limit on the serial buffer. The camera I am using sends me a rather large image, so I figured I would increase the serial buffer limit to at least 10kB (to make my life easier and things run more smoothly). I was able to do this in the past with the Arduino, so I am sure its possible to do it with the Netduino as well. I looked under libraries>SPOT_Hardware and Framework>Core>Native_Hardware, but something tells me this is something completely different. FYI, I also installed MF porting Kit. I don't understand why I need this tho :P

#10 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 13 February 2011 - 08:16 AM

Hi dropsofjupiter89 To adjust the serial port's receive buffer, change the RX USART BUFFER SIZE in platform.h. It's 512 bytes by default. C:\MicroFrameworkPK_v4_1\Solutions\Netduino\platform_selector.h #define PLATFORM_DEPENDENT_RX_USART_BUFFER_SIZE 512 // there is one RX for each usart port You'll need to recompile the firmware and deploy your custom firmware to the Netduino to make this sort of change. We could also make this user-configuration at runtime in a future release of the Netduino firmware if we get enough requests. Chris

#11 dropsofjupiter89

dropsofjupiter89

    Member

  • Members
  • PipPip
  • 15 posts

Posted 13 February 2011 - 08:57 AM

Thank you again. To other users: For some reason, I don't have "..\Solutions\Netduino\", I was able to find Chris's suggested file in "...\Solutions\Windows2\platform_selector.h". Yes sir. You should definitely make it user configuration in the future. Its really simple for me to change the buffer size, but you could make it a lot more simple in the future. Also, I have something that might interest/intrigue you. I have been testing the serial port for the past 24 hours and I can tell you for certain that it allows 1024 bytes. However, contrary to my statement, the platform_selector.h clearly defines the RX Buffer size as 512. You might want to keep check it out during future release(s).

#12 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 13 February 2011 - 09:22 AM

Hi dropsofjupiter89,

To other users: For some reason, I don't have "..\Solutions\Netduino\", I was able to find Chris's suggested file in "...\Solutions\Windows2\platform_selector.h".


To get the Netduino solution files, be sure to download the Netduino firmware patch (and then copy it into your .NET MF source folder, overwriting any existing files).
http://www.netduino....inofirmware.zip

After you make the changes, you will need to recompile and reflash the firmware.

Yes sir. You should definitely make it user configuration in the future. Its really simple for me to change the buffer size, but you could make it a lot more simple in the future.


I will put it on the feature request list. Makes sense to be a new feature.

Also, I have something that might interest/intrigue you. I have been testing the serial port for the past 24 hours and I can tell you for certain that it allows 1024 bytes. However, contrary to my statement, the platform_selector.h clearly defines the RX Buffer size as 512. You might want to keep check it out during future release(s).


Hmm. I'll have to check on that. I know that there should be two buffers of 512 bytes, one for each of the two serial ports.

Chris

#13 dropsofjupiter89

dropsofjupiter89

    Member

  • Members
  • PipPip
  • 15 posts

Posted 17 February 2011 - 07:48 PM

I pretty much have the entire camera working now. My only problem right now is proper ASCII conversion. For example, "Š" is interpreted by C# has hexadecimal of "160", where else, in reality, its actually '8A'. Some online converter also have this error. I assume its not an error at all, rather, a different "type" of interpretation of the ASCII table. I'm trying to figure that out. I will post some pictures as soon as I have resolved it.

#14 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 17 February 2011 - 08:00 PM

My only problem right now is proper ASCII conversion. For example, "Š" is interpreted by C# has hexadecimal of "160", where else, in reality, its actually '8A'.

Yep, those codes are for different code pages: "Š" has code 0x160 in UTF-8 and 0x8A in Windows Latin 2 Central Europe (code page 1250).

#15 dropsofjupiter89

dropsofjupiter89

    Member

  • Members
  • PipPip
  • 15 posts

Posted 17 February 2011 - 09:18 PM

Thanks CW2. I check out what you said, and you are in fact right. I didn't know about these code pages until I checked them out right now. I plotted the same picture using different codepages (including 1250), however, the image is still not as good as it should be. How can I find out what code page the program used to write to the text file? I used this program called "processing" (which is a side program that comes with "Arduino"), and it doesn't specify what encoding it uses to write to a file.

#16 dropsofjupiter89

dropsofjupiter89

    Member

  • Members
  • PipPip
  • 15 posts

Posted 17 February 2011 - 09:29 PM

Actually, I got it all wrong didn't I? When I send the data from the Netduino to the Arduino Board, the "byte values" are converted to "ascii values". The encoding that takes place during that process is the encoding I should use to retrieve the "ascii values" back to "byte values".

Question: When I send byte values from the netduino to arduino via serial port, how can I set the encoding of the ascii values that will be transferred over?

#17 dropsofjupiter89

dropsofjupiter89

    Member

  • Members
  • PipPip
  • 15 posts

Posted 20 February 2011 - 08:07 PM

I got it to work :)
Here is a preview of the image.
Thanks to everyone who helped out.
My link

#18 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 25 February 2011 - 01:01 AM

I got it to work :)
Here is a preview of the image.
Thanks to everyone who helped out.
My link


Awesome! Do you have a writeup or video of your project? We'd like to tweet about it and celebrate your ingenuity!

Chris




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.