Tagged Posts

Over the next couple of days people should be receiving their Netduino Go Piezo Buzzer Modules, at least if they have ordered them from Amazon.

I was lucky enough to get mine very quickly from Amazon and put together a sample project the other night. This is by no means a complex project, and most of it is code from the public domain for projects based on the original Netduino.

Project Overview

So what does the project do? Essentially it plays 3 “tunes” that are predefined in the code. The tunes and most of the code for the project are based on this thread on Netduino.com.

The primary method for interacting with a Piezo Buzzer module is pretty simple, you just need the following three lines.

PiezoBuzzer Pb1 = new PiezoBuzzer(GoSockets.Socket1);
Pb1.SetFrequency(####);
Thread.Sleep(####);

Socket1 would be the location where you have the module plugged in to the Netduino Go. The ### for SetFrequency is a float, 440.00 should be an A where the note C would be 261.63.Duration is an integer in milliseconds, so 1000 would be 1 second. Basically once you set the frequency you tell the program to sleep for 1 second to let the note play out.

The code in the project is a little more complex than that, providing octaves of notes and their frequencies, as well as the ability to pass in an array of notes and tempo to adjust for speed/duration.

Download the code

But enough of that, how about a video of it in action?

Other Netduino Go Projects

Be sure to check out some of my other Netduino projects and blog posts.

The @Netduino tank is finally ready for @makerfaire

It was About 8 or 9 months ago that I posted my first video using my Netduino powering a Tamiya Tracked Vehicle Chassis Kit. After that I actually did a little more work on the project, but I never posted any video or updates for the project itself.

Last week I was asked if I still had the project, and would be able to bring it to the Maker Faire. I thought, sure thing! So I got to work making it actually do something a bit more than going in a very long slowly arcing circle.

V1.5 (if you consider the video linked above v1) actually had a piece of plexiglass as a base, sitting on some standoffs up off the wooden base of the Tamiya kit. But it was my first time working with PG and I ran into a couple of issues, I drilled holes and they weren’t right, so I drilled some more, and they still weren’t right, the "rectangle” was off center on the vehicle itself, and I never even got around to taking the protective coating off the plexiglass. I did mount a GoPro camera on it, using zip ties, and drove it around the office scaring the pets, but never published that video, or even took pictures of the setup.

Thursday evening I decided I would try to take the motorshield I was using and make it work with the Netduino Go. Unfortunately due to a bug with PWM in .NET MF 4.2 qfe1 (or whatever is currently release) I was unable to get the Go working, so I wasted a full evening of time.

Friday evening I got to work getting the original Netduino going again, along with the motorshield, and a new piece of plexiglass. The end result was the photo seen above, a cell phone picture taken at something like 2 in the morning Saturday before Maker Faire, so I apologize for that :D

I ended up doing a little bit of coding, on the project (all sample code is hosted on Codeplex, at the time of this blog it is using Changeset 67198 (motor test project). I didn’t add a bunch of logic to the code, it basically has 4 programs, one that spins, goes, and repeats. Another that just spins. Another that goes forward then backward, and finally one that doesn’t do anything (stop). You can trigger through the programs using a button that was wired into the breadboard. Not the ideal setup, as the button was hard to get to while it was moving, but it was 2am and I just wanted to finish.

I made the programs fairly short because I figured that the area where it would be displayed wouldn’t be very big, unfortunately even with the short programs there wasn’t any way to safely have it running during the Maker Faire, so it for the most part remained unplugged the entire weekend. But it looked cool!

Speaking of looks, I took another piece of black plexiglass and cut it, shaped it on the belt sander, and then took the drill press to it to create holes for the standoff mounts, and somewhere to mount the Netduino/Shield to.

I also stuck an old (think original AAA battery powered, pre HD/960) GoPro camera to the front, this was all for show at this point, there was no chance I was going to get it wired up, and I really just needed the weight up there to keep the nose down. The back end was rather heavy due to the two battery packs, one for the Netduino one for the Motorshield, and it wanted to ride a wheelie without the camera up front.

Update (before I even posted the original blog) I stuck the GoPro 3D Case and two cameras up front to shoot some video and photos, you can see them below. This setup weighed the front end down heavily, and also, on a rough surface (bricks outside) started to cause problems for the tracks, I haven’t tried to figure out why yet, but they were coming off pretty regularly.

Here’s some video of the Netduino Tank in action, though I promise you it isn’t all that fancy yet Open-mouthed smile

and then of course 3D Video of what it sees (you’ll want to wear red/blue glasses for this one, or turn off 3D on youtube)

Photo Gallery

Parts List (quantity)

  1. Tamiya Tracked Vehicle Chassis Kit $20 (1)
  2. 9V Battery Case (1)
  3. AA Battery Case 4-AA (1)
  4. Plexiglass platform
  5. Long screws (4)
  6. Nuts, for above. (4)
  7. Aluminum spacers, mounted between base and platform (4)
  8. Small breadboard (1)
  9. Heat shrink
  10. Solid core wire
  11. Plexiglass Sheet

What’s Next?

1) I would like to add some sensors to it so that it can move around on its own a bit, and know when it should turn around.

2) I’d like to get the Wi-Fi-bac for the GoPro Hero 2 setup, whenever it comes out (this summer) and mount a Hero2 up front so I can stream video using the camera. This wouldn’t actually wire into the Netduino in any way, but I can imagine putting the GoPro on a servo system so that the Netduino could at least “point” the camera, at what, I don’t know yet.

3) It needs either a remote control (DotNetNuke module) and Wifi access or some other wireless access to the tank and send commands.

In case you missed the announcement on 4/4, the guys and Secret Labs, along with other members of the Netduino Community have come out with a new platform called Netduino Go. Head on over www.netduino.com for the introduction forum post.

This post is how to quickly get up and running with your Netduino Go, based on Chris Walker’s getting started forum post, with some enhancements that I think will make it easier to get up and running, as Chris’ post unfortunately leaves a few things out.

Hardware

I ordered a variety of hardware when I ordered my Netduino Go here’s a list, though in this tutorial I’ll only be using a small portion of this.

  1. (1) Netduino Go
  2. (1) Shield Base Module
  3. (2) RGB LED Module
  4. (4) Button Module
  5. (1) Potentiometer Module

One thing to keep in mind with the hardware is that each module needs a cable to be able to connect to the Go, but the Go only comes with two cables. I did order a 5 pack of cables as well, and up until about 2 minutes ago thought I left them at the office, only to realize I do have them at home, which is going to change the rest of this tutorial.

Software

  1. Visual Studio 2010
  2. .NET MicroFramework V4.2

First and foremost, you need to install the .NET MicroFramework 4.2 and Visual Studio 2010 (not sure if express will work). Chris’ post assumes that you already have .Net MicroFramework V4.2 installed. You can download this from Codeplex though to be honest I don’t know if you need the PK or the SDK, I installed both.

What will the project do?

Before we get into actually creating the project, what will it be? Well this is just something simple, nothing useful, but hopefully gives you an idea how to work with the Netduino Go.

We’re going to use the Netduino Go, one Button Module, one Potentiometer Module, and 3 RGB LED Modules. The button will be used to turn the system on and off. The RGB LEDs will blink in succession, one Red, one Green and one Blue (I realized during the development that I only had 2 RGB LED Modules, so I removed Blue from the code with comments, I ordered two more they should be here Friday. The potentiometer will be used to control the timing of the light succession.

Project Creation

For the first part of this you can follow Chris Walker’s instructions posted in the thread, copied here for ease of reading.

To manually create a project for your Netduino Go:

  • Download and unzip the attached assemblies.
  • Create a new .NET Micro Framework "Console Application"
  • Add the references "GoBus.dll" and "SecretLabs.NETMF.Hardware.NetduinoGo.dll" to your project. You'll need to use the "Browse..." tab for the moment.
  • Add the references to the go!modules you'd like to use (NetduinoGo.Button.dll, Nwazet.Relay.dll, etc.)
  • At the top of your project, add the line:
using SecretLabs.NETMF.Hardware.NetduinoGo;

From here I’ll switch out of Chris’ examples and provide my own code.

Plug your NetduinoGo into the MicroUsb cable attached to your computer. It might take your PC a few moments to find the drivers.

Right click on the Project properties and be sure to change your target framework to 4.2. You’ll also want to change the Deployment options on the .NET Micro Framework tab in the project properties, Transport = USB and Device = NetduinoGo_NetduinoGo.

The first thing we’re going to do is initialize the objects we’re going to use.

static NetduinoGo.Button button = new NetduinoGo.Button(GoSockets.Socket1); 
// this button will start/stop the flashing
static NetduinoGo.RgbLed redLed = new NetduinoGo.RgbLed(GoSockets.Socket2);
// this is the socket for the first LED

static
NetduinoGo.RgbLed greenLed = new NetduinoGo.RgbLed(GoSockets.Socket3);
// this is the socket for the second LED

//static NetduinoGo.RgbLed blueLed = new NetduinoGo.RgbLed(GoSockets.Socket4);
// this is the socket for the third LED
public static bool currentState = false; // keep track of if the button was pressed to turn it on, or off static NetduinoGo.Potentiometer pt = new Potentiometer(GoSockets.Socket5);
// the potentiometer to control the speed of the LEDs

We’re going to have a single method that turns off all the LEDs, likely not the most efficient approach, but it will do what I want. We also provide the button handler event.

//method to turn off all the LEDs
static void AllOff()
{
    redLed.SetColor((byte)0, (byte)0, (byte)0);
    greenLed.SetColor((byte)0, (byte)0, (byte)0);
    //blueLed.SetColor((byte)0, (byte)0, (byte)0);
}

//button handler
static void Button_ButtonReleased(object sender, bool buttonState)
{
    currentState = !currentState; //set the state to the opposite of whatever we were before
}

The Main() for the project is a bit longer, but nothing too complex. Basically we wire up the button handler, make sure to start in the off state, and then setup our While loop. Because we’re running on a device, this loop While(true) will just loop forever.

Inside of the loop we’re going to check if we should be on or off, if on, we go through and pass through each RGB LED Module to turn it on, then sleep for a moment, how long is based on the potentiometer, and then turn off the LEDs, move on to the next color.

public static void Main()
{

    button.ButtonReleased += new NetduinoGo.Button.ButtonEventHandler(Button_ButtonReleased); 
// setup the button handler currentState = false; //make sure we start with it off while (true) //we're using a device, it will never end { if (currentState) // see if we should be displaying the LEDs or not { redLed.SetColor((byte)255, (byte)0, (byte)0); // turn on the red LED System.Threading.Thread.Sleep((int)(100 * pt.GetValue()));
// pause for a moment based on the potentiometer state
AllOff(); // turn off all LEDs greenLed.SetColor((byte)0, (byte)255, (byte)0); // turn on the green LED System.Threading.Thread.Sleep((int)(100 * pt.GetValue()));
// pause for a moment based on the potentiometer state
AllOff(); // turn off all LEDs //blueLed.SetColor((byte)0, (byte)0, (byte)255); // turn on the blue LED //System.Threading.Thread.Sleep((int)(100 * pt.GetValue()));

// pause for a moment based on the potentiometer state

//AllOff(); // turn off all LEDs } } }

Once you have all this together you need to be able to deploy the code to your Netduino. Deploying the code is easy, simply hit F5 in Visual Studio and that should send it off to your device. From there you can see how well it works.

Here’s a video of the code in action on my Netduino Go, I’ll see if I can’t get another video done when I get the third LED module in place (only 2 for now).

For another overview and tutorial check out Pete’s blog post over on 10rem.net

UPDATE

I've updated the code to work with 3 RGB LED modules, you can find the updated code on Github at https://gist.github.com/2418912 

Here's an updated video, filmed using a GoPro, let me know what you think of the video quality.

A couple of weeks ago I picked up this Tamiya Tracked Vehicle Chassis Kit with the intention of using it with my Netduino. I put it together, but didn’t get around to doing anything with the kit and the Netduino until tonight. Part of the reason I didn’t get it going was the fact that I didn’t have my Adafruit Motor Shield together, I managed to get that completed over the weekend (minus one solder I found that I had missed tonight). Read the full post for all the details!

Maker Shield SolderingBack in May I picked up a variety of parts from the MakerFaire in San Mateo. One of those parts (2x actually) was the MakerShield.

I don’t think I’ve ever soldered this much on a circuit board before. I did plenty of soldering for the Project 240z back in the day, but it was all just joining wiring together for the Megasquirt and the fuel injection system. You can see some photos of the MakerShield here.

I’m playing around with the Netduino a little bit tonight. I ordered a couple of months ago from Amazon, and haven’t had the time/energy to do anything with it until tonight. That finally changed though, I was shocked how easy it was to get going with it. Basically here were the steps to get started: (I followed the instructions and steps from https://netduino.com/downloads/)
RSS URL

Chris Hammond

Chris Hammond is a father, husband, leader, software developer, photographer and car guy. Chris focuses on the latest in technology including artificial intelligence (AI) and has spent decades becoming an expert in ASP.NET and DotNetNuke (DNN) development. You will find a variety of posts relating to those topics here on the website. For more information check out the about Chris Hammond page.

Find me on Twitter, GitHub and LinkedIn.