Fredfish's Netduino thread for Programmer noobs and dummies

Fredfish

New member
I picked up my Netduino, breadboard, Onewire temperature sensor and bits 'n bobs and installed C# on my son's laptop. This afternoon, after some fiddling to figure out someone else's onewire code, I can now tell you the temperature of my apartment every 30 seconds or so.

The plan is to keep my son entertained until he's off to university to study programming and get myself a nice little aquarium controller.

at iced98lx's suggestion we started off with the temperature probe. The one I chose is based on something called onewire. Its almost like a primitive network protocol in that you can have a whole bunch of onewire devices connected to the same wire and have them all talk to your controller, which, in this case, is a Netduino.

Long story short, we ended up copying a class written by someone else to simplify talking to the sensor. It would have been quite a challenge to figure out with little programming experience.

Right now the code runs in debug mode and sends its temperature data back to the development environment on the laptop.

The next step is to store the data somewhere and find a way to pull or push it to a connected laptop. I'm thinking it would be nice to pull the data into a browser window from the get go. If we do this with the temp data, it should be easy to incrementally add other data sources like ph, or alkalinity.

Iced, when you read this, I'd like your suggestions on where to start reading to figure out stage two. Don't want to keep copying other people's code otherwise junior is never gonna learn anything. :D
 
C Programming - for the Absolute Beginner
by Michael A. Vine

I have tried to learn C from other books but they all required prior programming knowledge. I even purchased the Arduino books by Simon Monk, which were still of no help. The above book is the one you need to give you the background before starting any other book. (I have found most programming books to be incredibly dry and boring.)
 
I also am diving into Arduino based controller for simplicity and availability as well as price for parts. I am in the 3rd year of my BSIT (Bachelors of Science in Information Technology) focusing on programming. This is a great way to build basic programming skills. One of the best learning experiences I ever had was building a menu system that was dynamic and allowed additional menus/parameters to be added to the design without recoding (Object Oriented Programming). This was working on concepts for an aquarium controller. I did run into a problem though. I was trying to get too detailed and ran out of memory :hmm5:

I use the Arduino with 110v relays and have had them running for over a year with no problems. Very reliable if coded properly. Just one key point in programming, design! Code should never be written until the entire concept is designed and transferred to pseudocode/flowcharts for concept analysis. This will increase the quality of the design and avoid many errors. I will try to dig up some of my old code.
 
I picked up my Netduino, breadboard, Onewire temperature sensor and bits 'n bobs and installed C# on my son's laptop. This afternoon, after some fiddling to figure out someone else's onewire code, I can now tell you the temperature of my apartment every 30 seconds or so.

The plan is to keep my son entertained until he's off to university to study programming and get myself a nice little aquarium controller.

at iced98lx's suggestion we started off with the temperature probe. The one I chose is based on something called onewire. Its almost like a primitive network protocol in that you can have a whole bunch of onewire devices connected to the same wire and have them all talk to your controller, which, in this case, is a Netduino.

Long story short, we ended up copying a class written by someone else to simplify talking to the sensor. It would have been quite a challenge to figure out with little programming experience.

Right now the code runs in debug mode and sends its temperature data back to the development environment on the laptop.

The next step is to store the data somewhere and find a way to pull or push it to a connected laptop. I'm thinking it would be nice to pull the data into a browser window from the get go. If we do this with the temp data, it should be easy to incrementally add other data sources like ph, or alkalinity.

Iced, when you read this, I'd like your suggestions on where to start reading to figure out stage two. Don't want to keep copying other people's code otherwise junior is never gonna learn anything. :D

Congrats, if you read my thread, that's where my controller started as well!

Next step is starting to do some logic- I'd look at adding a float valve and a relay, and setting up an ATO. Copying others code isn't bad- so long as Junior takes time to read through, understand what each line is doing, and takes time to modify to work for his situation. If you're not ready to put things in water use a regular switch, and start figuring out how to turn on a light through code when the switch is flipped (you can use the onboard LED and button for that).

My ATO runs on a event, meaning it doesn't loop over it (in my code) and keep checking the status of the switch, instead, it waits until the switch is flipped and 'fires' an event. (one of the perks of the netduino!)

I broke my project down into libraries that I borrowed and modified and then routines to control each bit and piece, so there should be some decent examples there. Start practicing comparing the Temp to a pre-determined range, outputting if it's within/not within range. (AKA learn about variable types and what can compare to what). Figure out how to show how long the temp has been out of range (Learn DateTime field and TimeSpan field) etc.

Excited to hear you got it up and going, it's a frustrating fun project to put together!
 
...
Excited to hear you got it up and going, it's a frustrating fun project to put together!
Thanks! So far its more bewildering than frustrating. A lot of the examples out there assume you know the basics of object oriented programming. I've read your thread several times over and its a great help.

I broke my project down into libraries that I borrowed and modified and then routines to control each bit and piece, so there should be some decent examples there. Start practicing comparing the Temp to a pre-determined range, outputting if it's within/not within range. (AKA learn about variable types and what can compare to what). Figure out how to show how long the temp has been out of range (Learn DateTime field and TimeSpan field) etc.
I guess borrowing is ok. I'm the kind of person that needs to figure things out to have them sink in. Reading other people's code doesn't seem to stick for me.

I like the idea of playing with temperature ranges. That would be a good extension of the existing code. Thanks for the suggestions.
 
Thanks for the replies reefnoob and josh. Since this is C# and .net, I'm not sure how directly applicable a standard c manual would be.
 
Not done any reading on the netduino (yet) but coding is (relatively) simple, so long as you take your time. And, if ever in doubt, ask! You'll always find someone who will help, and usually the same person will be willing to explain (actually more useful than just posting the code solution!).

Best way to learn, as has been suggested, is to get stuck in :)

Tim
 
Thanks Tim. I'm good at asking questions. Used to drive some of my teachers crazy. :)

I'm thinking that monitoring a temperature range might just be a good opportunity to play with event based code. It should be easy to watch for a temperature event over a set point and trigger a timer and second set of code that watches for the temperature to go back below that set point, turning off the timer. From there, get you timer value and you know how long you have been over the set point.

Apparently my son has already played with event based code while fooling around with game maker.
 
Back
Top