Tuesday, December 27, 2011

Netduino - Long awaited update

Its been a long time since I posted anything, but my project has come a long way during this time...

Since my last post which was me drawing my schematic for a PCB to be printed, I have followed the advice of a few people over at the netduino forums (mainly mario and mark) and have nearly finished making a protoboard. I am getting on quite well, the schematic has changed a little here and there and I'm sure during testing and programming of my protoboard there will be even more changes and additions to come.

So far I have done the vast majority of soldering on my protoboard, I started with the layout, which I must say doesn't entirely represent my PCB layout, but I guess this is to test the circuit works as expected. I've got the RTC, the 595s and 165s completely soldered up and as you can see in the picture below, I have tested the shift registers and they are working perfectly!

I am really pleased with this, nothing has set on fire, gone bang or more disappointingly... done nothing! So this is a good start.

Next I am going to test that the RTC works and then I will be able to test the netduino pluged straight in to my protoboard without wire connecting specific things up. Once that is working I will finish off the LCD connection soldering and 4052 serial mux so I can select the LCD as a device. This will be the first time I have used the 4052 so it will be an interesting test, fingers crossed all will be well.

The osscilator for the tlc5940s is barely on the board yet, I have litterally just placed the chip holders, soldered some headers for the pwm outs and attached the power and grounds. I could really do with testing this on some breadboard first as I am still a little unsure as to how the osscilator needs connecting up.

Hopefully in my next post I should have a working clock, LCD and a soldered up osscilator!

P.S. Here is a top and bottom view of the board

Sunday, October 2, 2011

Netduino - Aquarium Schematic

Here is my first attempt at drawning a project schematic, I may still need to add an extra 74hc595 and there needs to be 2 daisy chained tlc5490's for pwm control.

Tuesday, September 27, 2011

Netduino - SD Write, Right?

I've decided to upgrade to the latest firmware 4.2.0; although this does not have 1-wire support it does fix a lot of other issues and when Chris over at secret labs gets round to releasing the 1-wire version I will inlude temperature readings back in my project.

In the meantime....

I have successfully managed to write a file to an sd card and then read it back.

Currently this was achieved using 2 seperate examples:

To write it I used this:

public static void Main()
StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Pins.GPIO_PIN_D8);

using (var filestream = new FileStream(@"SD\dontpanic.txt", FileMode.Create))
StreamWriter streamWriter = new StreamWriter(filestream);
streamWriter.WriteLine("This is a test of the SD card support on the netduino...This is only a test...");

using (var filestream = new FileStream(@"SD\dontpanic.txt", FileMode.Open))
StreamReader reader = new StreamReader(filestream);

To read it I used this:

public static void Main()
StorageDevice.MountSD("SD1", SPI_Devices.SPI1, Pins.GPIO_PIN_D8);

string[] directories = System.IO.Directory.GetDirectories(@"\");
Debug.Print("directory count: " + directories.Length.ToString());

for (int i = 0; i < directories.Length; i++)
Debug.Print("directory: " + directories[i]);

string[] files = System.IO.Directory.GetFiles(@"\SD1");
Debug.Print("file count: " + files.Length.ToString());

for (int i = 0; i < files.Length; i++)
Debug.Print("filename: " + files[i]);
FileStream fs = new FileStream(files[i], FileMode.Open, FileAccess.Read, FileShare.None, 512);
StreamReader sr = new StreamReader(fs);
Debug.Print("contents: " + sr.ReadToEnd());

The next plan is to test I can write, read, delete, edit and also control shift registers on the same bus.

Sunday, September 11, 2011

Netduino - First Rough Fritzing

Here is a rough fritzing of my project more or less so far, but with a few changes and additions that such as the serial mux/demux and the wifi module I will be adding.

Netduino - Issues and current activity

It has been some time since I made a proper post on my blog, a lot going on; with looking for a house, work and all that...

Any way more importantly what is going on with my project currently?

Well sadly at the moment not much in the way of development, I have been having a deployment issue for the last couple of weeks, ever since my rtc broke (that’s a thought could they be related and my netduino is actually damaged???). My rtc breakout broke, the crystal seemed to have stopped working and so the time would no longer increment. As far as the overall project was concerned, I was doing really well, I had temperature readings and time and date going on to the LCD with a nice fast refresh rate. I had added in temperature updates against the system clock, expanded my SPI output with 2 shift registers and was able to control LEDs and finally..... RELAYS!

I received my new rtc, soldered it all up and replaced it in my circuit, I uncommented all the lines relating to the clock, went to deploy and ran in to the error that has been plaguing me since:

"An error has occurred: Please check your hardware"

Since this error started I have tried everything I can think of; reinstall the entirety of visual studio, .net framework, netduino sdk, tinybooter, 4.1.1 firmware. I have also swapped computers, rolled back to older versions of my code checked all my connections, tried getting individual components and their corresponding code to work on their own and so far all I have managed to deploy is blinky LED and button press.

While I wait for some clues as to what the root and solutions of my problem may be, I have been busy researching and procuring additional components for other parts of my project. In the last weeks or two I have bought some 74HC165N's these allow for a multiplexed SPI input and I will be using these in accordance with Stephan’s fantastic class: https://stefan.co/netduino/multiplexing-with-bitshift-ics/. I have also bought some 74HC4052 serial multiplexers, this will be used as per atlas Scientifics example: http://atlas-scientific.com/_documents/Application_Note_stamps_001.pdf. This will be needed in order to use 1-wire for the DS18B20 temperature sensors, the serial LCD display, the PH stamp and the latest purchase....


Finally Wi-Fi will be coming to my project which is the ultimate point of this exercise, basically I started this project not only because of my interest in electronics tinkering, but also to help me learn both C# and websites (specifically ASP.Net which is what I will be using). My programing, although entirely self-taught (With a lot of fantastic help from many nice people in various forums, THANKS EVERYONE!), it has come a long way. At work I have written my first application with back end administration UI in VB. This is my first windows form application and although still in VB I am really proud of it, I have learnt and applied many standard programing techniques, such as arrays, functions, passing variable and making classes, which is great as my code is becoming more efficient. The application is basically an interim before we have an IDM to generate accounts and synchronise the Email, HR and Novell systems. It uses a database back end to analyse each system and a rules set to generate network and email accounts, allowing HR to generate accounts when they are entering new starters on the HR system and it automatically emails the account details to the employees manager. They can then key the account information in and IT then have an interface to view these and create the accounts in Novell and on the mail server. The application also does a lot of other analysis, it automatically checks for changes in HR records on a daily basis and creates reports, it checks and automatically removes records from the pending table once they exist in all systems. The final bit I am working on is getting it to produce a consistency report to say for each system what needs changing to make sure the data is mirrored consistently for each record between the systems and to get the one-click auto update function working.

Back to the aquarium project.....

I have also bought a couple of TLC5940 PWM expander IC's, these will be used to control fan cooling for the relay enclosure, fan cooling in the tanks and LED lighting for the tanks. I have spent quite a bit of time researching the Relay enclosure, I am yet to run mains through them, but as I understand they can get quite hot as there is some resistance created where the connection is made. I was originally looking a 1 big 300-350mm heat sink to sit the relays on; however this seems to be either very expensive or just hard to procure. My latest idea is to get 6 heat sinks designed for the 25amp SSR's that I am using, these are however quite big and so my idea of having a rather small enclosure for them is becoming somewhat of a pipe dream. I am now thinking of an abs electrical enclosure that I will expose the heat sinks towards the rear and will have a fan cooled baffle to provide additional temperature controlled cooling where needed. The electronics side will all be sealed to make sure they are completely water tight as this will be used near a fish tank. I am yet to decide whether to house the entire project in the one box or whether to have a separate box for the controller, but my idea is to use usb ports to connect the various components together. I will have a serial bus, an SPI bus, an I2C bus and a 1-Wire bus. My idea is to provide 5 or 10 usb ports to add additional devices to each bus and this will also allow for port expansion, possibly using modified usb hubs. So for example on the 1-wire bus I could have 10 temperature probes each with a usb connection at the end, and I simply plug them in to the 1-wire bus.

That’s all for now, fingers crossed I will get things working again shortly and stay posted as there are likely to be some big developments coming up in the next month.

Sunday, August 28, 2011

Netduino - LCD Fixed! Refreshing...

Ok I am getting back on track with my project, the lcd display is better than ever, I have extra functionality, can clear blocks as well as clear the whole screen and most significantly....


This is what I did, if you get the sparkfun lcd YOU WILL NEED TO DO THIS.

Here is the lcd: http://www.sparkfun.com/products/9351
Here is the new firmware: http://sourceforge.net/projects/serialglcd/files/

You will need:

AVR ISP Mk2 (or similar product): http://store.atmel.com/PartDetail.aspx?q=p:10500054
AVR Studio 5: http://www.atmel.com/microsite/avr_studio_5/default.asp?source=redirect

Simply connect up the isp to the 6 holes on the back of the serial display and power the board like this:

Then all you need to do is go in to avr sudio and go on to the programmer option, select the avrisp mk2 and the atmega168 and connect. You should have 2 green leds on the programmer, to test the connection click read on all the various values. It is also worth doing this to have a backup of the original firmware.

Next unzip the firmware, then in avr studio browse for the main.hex file in the flash memory.

Erase the device
Then program the new main.hex on

Thats it!