- Netduino Forums
- → Inquisitor's Content
Inquisitor's Content
There have been 91 items by Inquisitor (Search limited from 22-May 23)
#19667 20x4 Liquid Crystal Display
Posted by Inquisitor on 24 October 2011 - 12:56 AM in Project Showcase
Anyway, my first comparison and contrast with the two uses a 20x4 LCD using the HD44780 chipset for output. Along the way, I ported the Arduino LiquidCrystal library over to Netduino. And yes, I know I didn’t really have to. But if you read the blog entries, you’ll see it became a challenge. And in some cases, it might be useful to someone.
If there is any interest and if it’s allowed, I can put the library in the Wiki.
Blog Entry for LCD driven by Arduino (http://MessingWithReality.com/whats-going-on-in-there/)
Blog Entry for LCD driven by Netduino (http://MessingWithReality.com/cough-it-up/) Includes source code and sample test application
#18085 read file in SD card : OutOfMemoryException
Posted by Inquisitor on 16 September 2011 - 02:37 PM in Netduino Plus 2 (and Netduino Plus 1)
#17830 What are my options for increasing memory and deploying updates
Posted by Inquisitor on 10 September 2011 - 11:49 AM in General Discussion
And the point... is for your prototype machine... one project may need networking, next might not... but need lots of space. So reload Netduino... reload Netdunio Plus... wah... la.
#17829 Mini Availability
Posted by Inquisitor on 10 September 2011 - 11:35 AM in Netduino Mini
I'm glad to hear its going well for you. I was just sure someone has a new product using one and ordered a million copies!Hi Inquisitor,
We're busy making more
Several international resellers have them, but quite a few resellers are out right now.
Chris
#17814 Instantiations when switching mode
Posted by Inquisitor on 10 September 2011 - 12:17 AM in Netduino Plus 2 (and Netduino Plus 1)
If you want to go wireless, this is an inexpensive solution:
http://www.sparkfun.com/products/10534
http://www.sparkfun.com/products/10532
I wanted to use this solution for making wireless MIDI, but sadly it's too slow (standard MIDI is 31.25 kbps). I haven't checked whether this can be pushed up somehow. The bearer frequency indicates the information bit rate could be much higher than 4800 bps.
But for many other uses it should be fine.
I've been hoping someone knowledgeable about wireless options might do a comparison and contrast. And would still welcome it. In the meantime, I stumbled across this one Wireless Comparison
Also andersborg,
For a little more (actually cheaper than your suggestion if you needed to do duplex) you could go with this one which has a data rate of 115 Kbps, with buffering, duplex and plenty of other features for $7
And for a little bit more you can get this multi frequency unit which has even more features… why, I don’t know, but it has extra 8 bit ADC, temperature sensor and RX and TX FIFO, and low battery detection for $12.
#17811 Mini Availability
Posted by Inquisitor on 09 September 2011 - 09:34 PM in Netduino Mini
#17809 What are my options for increasing memory and deploying updates
Posted by Inquisitor on 09 September 2011 - 03:11 PM in General Discussion
I shouldn't need to use GetMethods or GetParameters since I'm writing the code myself I will already know the Methods and Parameters for them.
That what is normally expected.
In my case, I was trying to make a Web Server, but I wanted it to support the MVC coding style for server applications. So in addition to hosting the easy html/script/resource files on the SD card I also wanted end-users to be able to have their own binaries. The server piece would then have to inspect the user's "Controller" classes, get their methods and parameters. I was "hoping" to do parsing of the request string into parameters and call their methods... just like MVC running on IIS. And I was right there... until I started looking for "GetParameters".
It was not to be. Dammit!
#17808 What are my options for increasing memory and deploying updates
Posted by Inquisitor on 09 September 2011 - 03:03 PM in General Discussion
#17807 What are my options for increasing memory and deploying updates
Posted by Inquisitor on 09 September 2011 - 02:51 PM in General Discussion
Is reflection supported? If so what about using Assembly.Load and then .CreateInstance
Sorry, didn't answer the second part... This works.
using System; using Microsoft.SPOT; using System.IO; using System.Reflection; namespace Sandbox { public class Instantiate { private Assembly _ass; private object _obj; private Type _type; private MethodInfo _mi; private MethodInfo _ma; public Instantiate() { try { FileStream fs = new FileStream(@"\SD\bin\OutsideLE.pe", FileMode.Open); byte[] image = new byte[(int)fs.Length]; fs.Read(image, 0, (int)fs.Length); fs.Close(); _ass = Assembly.Load(image); _obj = AppDomain.CurrentDomain.CreateInstanceAndUnwrap( "Outside", "ASSM.TestClass"); _type = _ass.GetType("ASSM.TestClass"); _mi = _type.GetMethod("Print"); _ma = _type.GetMethod("DoSomeMath"); _mi.Invoke(_obj, null); } catch (Exception ex) { Debug.Print(ex.Message); } } public long DoSomeMathExternal(params object[] args) { return (long)_ma.Invoke(_obj, args); } } }
The object in the SD binary file
using System; using Microsoft.SPOT; namespace ASSM { public class TestClass { public TestClass() { Debug.Print("TestClass Instantiated"); } public void Print() { Debug.Print("Hello there"); } public long DoSomeMath(int a, int B) { return a * b + b; } } }
#17805 What are my options for increasing memory and deploying updates
Posted by Inquisitor on 09 September 2011 - 02:27 PM in General Discussion
Is reflection supported? If so what about using Assembly.Load and then .CreateInstance
Some reflection is supported. I was going great guns on a project, until...
You can find methods on an object, but you can't query for parameters.
Type typ = GetType(); MethodInfo[] methods = typ.GetMethods(); ParameterInfo[] prms = methods[0].GetParameters(); // <==== This doesn't exist.
#17802 Netduino vs Arduino
Posted by Inquisitor on 09 September 2011 - 11:36 AM in General Discussion
#17777 Working with UART
Posted by Inquisitor on 08 September 2011 - 07:38 PM in Visual Studio
If you are just trying to mess with the serial port code in general on the Netduino and intended to have it talk to itself, you need to connect a wire from port 1 to port 2 on the digital side. Once you do that, your code will work fine. However, If you did that, you’ll also find that there is no indication that it’s working. Once I added the Debug.Print statement below, you can see that it’s receiving.
using System; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware.Netduino; using System.Threading; using Microsoft.SPOT; namespace SerialPortLearn { public class Program { static SerialPortHelper serialPortHelper1 = new SerialPortHelper(); public static void Main() { serialPortHelper1.PrintLine("Initializing..."); while (true) { string line = serialPortHelper1.ReadLine(); if (line.Length > 0) { Debug.Print(line); serialPortHelper1.PrintLine("Readed: " + line); } } } } }
If you are trying to interface with some other device… like a computer, then I can tell you, your code is fine and then the problem is with your wiring to/from the computer or the computer software on the other side.
Good Luck!
#17774 What are my options for increasing memory and deploying updates
Posted by Inquisitor on 08 September 2011 - 05:59 PM in General Discussion
#17773 What are my options for increasing memory and deploying updates
Posted by Inquisitor on 08 September 2011 - 05:50 PM in General Discussion
Thanks for the reply. This sounds promising. What is the largest SD card the netduino plus can support? I can see myself having the main application on the main memory and loading and unloading dll's from the SD as needed.
You got it. I know the current framework (4.1) limit is 2GB. Which is what I have. But I read that the 4.2 it tackling that one and various people have used at least 4GB. I haven't heard yet what the upper limit is going to be.
NOTE: Oh, also, I was looking at this method to handle the code updates for customers you mentioned. Its a whole lot easier (for the customer, not the developer) to just upload through the Internet via the Network connector and on down to the SD card, have the Netduino reboot and they get an upgraded application. Also, I noted that once the Application.Load() has finished loading, it doesn't lock the file... like the desktop does. So you can upload a new program even while the old program is running! Way cool! Just got to make sure the resident program stub is bullet proof! Good luck. Take the plunge.
#17769 What are my options for increasing memory and deploying updates
Posted by Inquisitor on 08 September 2011 - 04:40 PM in General Discussion
GOT to be a story behind that name!
I know I had a lot of the same concerns before I actually got a Netduino Plus... especially since it has even less room due to its support of the networking and SD card. But I’ve been surprised at how small the C# code I write is compiled down to before installing on the Netduino.
You can use an SD card for additional storage of resources, but not code space. That has to stay within the limits.
Colin, I’m not sure that is correct. AND, I’m not 100% sure I’m right either… AND IT’S A REAL PAIN IN THE ASS… but,
In the old days (aka Stone Age, IBM PC running a whopping 4.77 MHz) you had to segment out your code into sections. When you needed certain functionality, you dynamically loaded that off the
Now… if you are needing all your code in the 28K memory at once, OR can’t live with the delayed loading, then basically… I’d have to agree with ColinR… you’re basically SOL.
If anyone is interested, I’d be glad to try and do that loading/unloading thing and see how large a program I can get into OFMME (Old Fart Memory Management Engine).
Would anyone happen to have a large C# code base they want tried?
#17768 Working with UART
Posted by Inquisitor on 08 September 2011 - 03:48 PM in Visual Studio
This code (at least) compiles. There are several things in it I wouldn’t do, but I don’t see any show stoppers. Your example only uses the one port for sending and receiving, and since you’re sleep deprived… I have to ask the obvious:
Have you got Netduino wired to feedback on itself?
Here’s an example I wrote to test the serial ports, but it uses both serial 1 and 2 on the same Netduino. I know it works, if you wire it up as indicated in the text. Serial Port Communication
Let me know either way… if you’re still having troubles this afternoon, I’ll look at it when I get home.
Good luck
#17757 Instantiations when switching mode
Posted by Inquisitor on 08 September 2011 - 01:48 PM in Netduino Plus 2 (and Netduino Plus 1)
Yes, that should work, and thanks for the example, but it's essentially compensating for a software design flaw with otherwise perfectly good hardware, which is the wrong way around.
It seems to me you are expecting a flat-bed truck (Netduino) which is very good at many things to also go race with a Formula 1 Ferrari (Arduino) that is excellent at only one thing. I wouldn’t give up multithreading to get real-time ability. But then, my garage can park a Ferrari right next to the Pickup truck.
Which brings up an interesting question...
Has anyone worked with connecting the Netduino with an Arduino... through serial, spi, digital/analog pins, mind-melding etc...
Might be some cool applications integrating this little $19 peripheral to a Netduino. Heck... putting only the right pins in, this might be a perfect shield/daughter card for our Netduino.
#17755 Working with UART
Posted by Inquisitor on 08 September 2011 - 12:59 PM in Visual Studio
I've a problem working with UART. I'm using SerialPortHelper library. But I can only write, not to write anything.
Here is my code: ...
As Mario mentioned, the variable named "line" is not defined. But then your compiler would have told you that... so I'm guessing it was accidentally deleted when you posted the code.
You might also add a little more information... like what behavior you are seeing besides "But I can only write, not to write anything." Either you miss-typed this sentence or you are struggling with English as a second language. I'd be glad to help, but I need a little more to go on...
#17717 Pinout Cards
Posted by Inquisitor on 07 September 2011 - 10:22 AM in General Discussion
I really like the pinout card that came with the mbed. As i haven't found anything similiar for the Netduinos, i created them myself. The diagrams are quite large in the PDFs, please scale them to your needs when printing. If someone spots an error please post it so i can correct the diagrams.
Tecchie
Thanks! These are great.
#17687 Junk Yard Dog
Posted by Inquisitor on 06 September 2011 - 06:39 PM in General Discussion
... (otherwise a little bit 'hacky' way ...
I'm not proud!
So far the my output's consist of blinking LED's or the Debug.Print statements. I'll take what I can get.
#17669 Junk Yard Dog
Posted by Inquisitor on 06 September 2011 - 01:01 PM in General Discussion
This little Harbor Freight volt meter is dirt cheap even when it’s not on sale. When it’s on sale, it’s usually in the $3 - $5 range. It’s often given away for FREE in magazine ads or like this past Labor Day sale. It comes with a 9V alkaline battery that costs more to replace than the whole meter.
Score 1 – I’ve got about a half dozen of these from over the years. I now use them to great advantage with the Netduino. I can wire them in all over my circuit and check voltage and/or current at multiple locations while I test my software/hardware configuration. And for those with dead batteries, I’ve hard-wired them to old 9V power supplies that I’ve kept from other long dead equipment.
Score 2 – This is way above my abilities… Is there way to use this LCD display for our Netduino’s? Obviously actively creating some circuit and software driver would be great. But maybe… there is some way to use it passively (similar to the way Mario used the picture frame above) by using some particular volt meter setting and the two input leads. Just a thought. If you come up with a method to provide this FREE display… you might even be revered as a god in the eyes of the Netduino and Arduino world.
#17665 Web-server & Muti-threading
Posted by Inquisitor on 06 September 2011 - 11:57 AM in Netduino Plus 2 (and Netduino Plus 1)
I get five levels. I can set up my tasks that I need it to do and prioritize them and simply let it loose. The Netduino will not starve any one of them.
Now this brings up an important question. For those threads that are implicitly created for us...
_highFrequency = new InterruptPort(pinDigital, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth); _highFrequency.OnInterrupt += new NativeEventHandler(PerHighFrequency);
… what are their thread priority and can we adjust it?
#17662 Web-server & Muti-threading
Posted by Inquisitor on 06 September 2011 - 11:42 AM in Netduino Plus 2 (and Netduino Plus 1)
Hi Inq,
I'm not sure that's correct... My understanding is that a multiprocessor PC with N cores will pick the highest N priority tasks to run, at any given time. This may sometimes result in a lower priority thread getting as much CPU time as a higher priority thread, but only if there are no other higher priority threads.
You are correct. I was being way too simplistic versus saying the textbook version as I should have. I was trying to compare and contrast the Netduino behavior with that of the PC’s multithreading and suggest people read the above article. If you are used to the PC’s multitasking behavior and are writing code for the Netduino expecting that behavior, you will be disappointed.
Scenario - You have two threads. Both have no Sleeps or other processor releasing methods. One thread is at a higher priority than the other by one level (say… one thread at BelowNormal and the other at Lowest). The code I supplied above illustrates this scenario…
On a PC 1 – If it is a single processor machine or a heavily loaded multiprocessor machine, it is possible to completely starve the lower priority thread.
On a PC # - If it is a lightly loaded multiprocessor machine (as most developers are developing with) the two threads will in essence get equal time.
On a Netduino – The lower priority thread will get 50% of what the higher priority thread gets. It will not get starved.
I’m sure it won’t be long before these Netduino’s are multi-cored… wonder which behavior we’ll get then.
#17612 Calculate processor usage (revisited)
Posted by Inquisitor on 05 September 2011 - 10:17 PM in General Discussion
Here is a Program.cs file to demonstrate its use. Basically, it’s a one-liner to add the CPUUsage object to your program and you can add it wherever you want (it doesn’t have to be at the beginning). Once running, the demo program will explicitly use to 10% of the CPU. It shows CPU=11% on my Netduino. There seems to be a little overhead of other things going on, but I’m not sure if it’s because of the CPUUsage object or not. Clicking the on-board switch causes the CPU to up the CPU usage by 10% until 100% and then re-cycles back down to 10%.
using System; using System.Net; using System.Net.Sockets; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.NetduinoPlus; using System.IO.Ports; using System.Text; using MWR; namespace Serial_Port { public class Program { const int WORK = 100; // ms to work... use something >= 1 private static InterruptPort _Switch; private static double _Use; public static void Main() { // Create our CPU Usage Object new CPUUsage(); // Hook up to the switch so we demonstrate changing the CPU usage _Switch = new InterruptPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth); _Switch.OnInterrupt += new NativeEventHandler(Switch_OnInterrupt); // Percentage of work to start with. _Use = 0.1; // 10% // Now do something to tie up the CPU double W = System.Math.PI; while (true) { long f = DateTime.Now.Ticks + 10000 * WORK; while (DateTime.Now.Ticks < f) { W *= System.Math.PI; W = ((int)W) - W; } int delay = 0; lock (_Switch) { if (_Use < 100) delay = (int)(WORK / _Use - WORK); } if (delay > 0) Thread.Sleep(delay); } } private static void Switch_OnInterrupt(uint data1, uint state, DateTime time) { if (state == 0) return; lock (_Switch) { _Use += 0.1; if (_Use > 1.0) _Use = 0.1; } } } }
Here is the CPUUsage class.
using System; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using System.Threading; namespace MWR { public class CPUUsage { private int _msAutoDisplay; private long _idle; private long _last; /// <summary> /// Create this object to monitor the CPU usage. /// Diagnostics go to the VS Output window. /// </summary> /// <param name="msAutoDisplay">Amount of time (ms) between updates</param> public CPUUsage(int msAutoDisplay = 1000) { _msAutoDisplay = msAutoDisplay; if (_msAutoDisplay > 0) { Thread t = new Thread(new ThreadStart(AutoDisplay)); t.Priority = ThreadPriority.Lowest; t.Start(); } new Thread(Idler).Start(); } private void AutoDisplay() { lock (this) { _idle = 0; _last = DateTime.Now.Ticks; } while (true) { Thread.Sleep(_msAutoDisplay); long per; lock (this) { long now = DateTime.Now.Ticks; per = 100 - _idle * 100 / (now - _last); _last = now; _idle = 0; } Debug.Print("CPU=" + per.ToString() + "%"); } } private void Idler() { long last = DateTime.Now.Ticks; while (true) { PowerState.WaitForIdleCPU(1, int.MaxValue); long now = DateTime.Now.Ticks; long delta = now - last; if (delta < 10000) // 1 ms lock (this) _idle += delta; last = now; } } } }
Hope this is useful to someone. And, of course, let me know if there is a better way. Thanks.
Good Luck!
#17572 What is this called?
Posted by Inquisitor on 05 September 2011 - 12:32 PM in General Discussion
This would be my guess.(see labels on photo)
The GND plane is pretty obvious - large filled area.
There is a cap between GND and what I would assume is VCC
VCC is also supplied to one pin of the sensor via a resistor. This would be a current limiting resistor for the LED side of the light gate.
The detctor side appears to have a connection to VCC and GND and two ouptuts. These are normally called A and B and are 90° out of phase. This allows you to work out which direction the sensor is moving.
If you think of the output as a 2-bit binaty value then the signal would 0-1-3-2 going in one direction and 2-3-1-0 in the other direction.
Mike P,
Thank you for the reply. Most of this fits in with what I’ve learned so far having started with the Sparkfun’s tutorial. It brings up a couple of questions if you or someone could help. I think the first thing that gets me second-guessing what I’m seeing is the additional stuff. In this case…
- there are two connectors with a total of 9 pins and I know no manufacturing engineer is going to let a high volume piece go out with things that aren’t needed.
- No capacitor was needed in the Sparkfun tutorial. All I know (so far) is… capacitors can store electricity and they act as some kind of filter for AC. What does it do in this circuit (just the technique name… I can look it up)?
- Taking a WAG… is this what’s called a “bandwidth filter”? And if so… what or why would we want to filter anything out of the signal?
BTW – What are you doing to insert the thumbnail?
- Netduino Forums
- → Inquisitor's Content
- Privacy Policy