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.
Referencing SecretLabs.NETMF.Hardware.AnalogInput will not work. Although it will let you compile - it can't find the assembly on the device.
Updating the analog input reference to .net mf 4.2's method will fix the issue (AnalogInput ain = new AnalogInput(AnalogChannels.ANALOG_PIN_A0). However, AnalogInput() now returns a double instead of a float.
I went and changed all references from floats to doubles to fix this issue (it seems most of the time the float was being cast to a double anyway).
The example config will not work. You'll need to prefix the JSON with var config= and put ; at the end.
You'll then need to update JSON.cs - configString = configString.Substring(12, configString.Length - 13); Completely forgot about this!!!!
The thingspeak/aquariumstatus plugins threw errors for me - but I just disabled them for the moment.
H07R0D - your code is exactly what I'm looking for and I plan on using it to write an output plugin to post data to my website.
Thanks!
Thanks for that JS catch!
If you're using a straight Netduino, and not an N+, the Thingspeak and status plugins will definitely not work as they are using IP stuff to function. Thingspeak writes straight out to their API through IP address, and status does timestamp updates through NST services. If you don't have an ethernet port, these definitely won't work.
I am only thinking our loud here. But the netDuino can produce a txt file correct? So if it can dump the file to a location: ftp, SD card, Drive space. I can create a windows service that moves the file and uploads the data at a set interval. I don't want my netduino to host a server, I know it can't perform that task and SQL isn't that small. LOL..
What I want to do is Netduino records data to file then file is uploaded then file is processed to SQL server. Thoughts?
I am only thinking our loud here. But the netDuino can produce a txt file correct? So if it can dump the file to a location: ftp, SD card, Drive space. I can create a windows service that moves the file and uploads the data at a set interval. I don't want my netduino to host a server, I know it can't perform that task and SQL isn't that small. LOL..
What I want to do is Netduino records data to file then file is uploaded then file is processed to SQL server. Thoughts?
I seem to be getting random uncaught exceptions.
It happens during the polltasks method but not every time, and happens randomly after executing the temperature plugin
An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.SPOT.Hardware.dll
Microsoft.SPOT.Hardware.dll!Microsoft.SPOT.Hardware.Port.ReservePin(Microsoft.Spot.Hardware.Cpu.Pin pin, bool fReserve)
[Managed to Native Transition]
Microsoft.Spot.Hardware.dll!Microsoft.Spot.Hardware.AnalogInput.Dispose(bool fDisposing)
Microsoft.Spot.Hardware.dll!Microsoft.Spot.Hardware.AnalogInput.Finalize()
I just received my netduino go, so let me get over the learning curve in the upcoming weeks and will be able to lend a hand.
Currently in school and work full time as a .net programmer so im pretty booked.
So I've hacked up H07R0D's code a fair bit..
- Downgraded to 4.1.1 (OneWire)
- Stripped it right down (removed unfinished web ui code and uneeded plugins)
- Wrote a plugin for DS18B20 temp sensor
- Wrote a plugin to post data to my own MVC Web API (will make this public)
Working perfect now!
Next is an 8 channel relay control plugin
I've now added support for multiple temp sensors on the one wire bus.
No need for storing rom id's as it uploads them to the webservice and you can give them friendly labels there.
var tempData = new TempData();
var ida = (InputDataAvailable)state;
var rom = new byte[8];
if (oneWire.Reset())
{
oneWire.WriteByte(OneWire.ReadRom);
oneWire.Read(rom);
var deviation = 0;
do
{
if ((deviation = oneWire.Search(rom, deviation)) == -1)
break;
if (OneWire.ComputeCRC(rom, count: 7) == rom[7])
{
if (rom[0] == DS18B20.FamilyCode)
{
oneWire.Reset();
oneWire.WriteByte(OneWire.SkipRom);
oneWire.WriteByte(DS18B20.ConvertT);
Thread.Sleep(750);
var matchRom = new byte[9];
Array.Copy(rom, 0, matchRom, 1, 8);
matchRom[0] = OneWire.MatchRom;
oneWire.Reset();
oneWire.Write(matchRom);
oneWire.WriteByte(DS18B20.ReadScratchpad);
var tempLo = oneWire.ReadByte();
var tempHi = oneWire.ReadByte();
tempData.SetValue(DS18B20.GetTemperature(tempLo, tempHi));
tempData.SetExtValue(OneWireExtensions.BytesToHexString(rom));
ida(tempData);
}
}
}
while (deviation > 0);
}
That's the exact same kit I went with, really nice having just a straight serial comm for all the details.
For my calibration, I just used a serial port from my PC and Putty. Made the calibration a lot easier than writing code for the Netduino.
I've written an app to do the calibration, which all works well (haven't got a PC that has a serial port - or a USB -> serial adapter).
But after the calibration has completed, it reads incorrect values.
7 shows 6.8 (unless I rest my hand on my mousepad, it then reads 7 - wtf!)
4 shows 4
10 shows 9.8
Their support was pretty quick to reply - have sent them a bunch of photo's and they said they'll look in to it.
Got my pH probe all sorted and it's logging to the website now.
How are you going with the WebServer H07R0D?
I tried adding NeonMika's code (http://neonmikawebserver.codeplex.com/), but I constantly get out of memory exceptions (even after removing a large chunk of the un-needed stuff)
Got my pH probe all sorted and it's logging to the website now.
How are you going with the WebServer H07R0D?
I tried adding NeonMika's code (http://neonmikawebserver.codeplex.com/), but I constantly get out of memory exceptions (even after removing a large chunk of the un-needed stuff)
Glad to hear the pH is going!
I've pulled the NeonMika repo as well, it does a lot of stuff very nicely. I'm stripping things down now, and I always find dropping anything XML will save a lot of space.
I'm working with that and pulling some concepts/code from https://github.com/o...p/TinyWebServer too. It's an arduino web server, so it's super small, and has a decent POST handler, which is my biggest concern.
But the holidays approach, so family/travel will be most of my time, probably won't have much time until after Christmas for more of this
Strent
Where did you get the relay and does it work with a 120 volt source?
I want to start building my power strip to manage pumps and lights.
Thanks,