Showing posts with label .NET Microframeworks. Show all posts
Showing posts with label .NET Microframeworks. Show all posts

Friday, July 25, 2014

Tampa IoT Society – and the start of a new era

This morning before I started my client work, I took a few minutes to configure my highly customized Intel Galileo board and was able to successfully run Windows on a Very Small device.  I’ve order some really cool parts from SparkFun that I hope to integrate with the board over the weekend. 

MyGalileo

Also – today I am announcing that I am formally rebranding the Tampa .NET Microframeworks Group as the Tampa IoT Society. Our next meeting August 19st  will be dedicated to going through how to get started and what you can do.  I’ll also be sharing and discussing our vision of what we will be looking at for the next 12 months.

-twb

Tuesday, April 15, 2014

Controlling a Netduino Robot with BlueTooth

For our April meeting, we will be controlling our Home-Built robot with a Windows Phone device, this should fun so hang on!

We will be using this Bluetooth Module

http://www.amazon.com/Arduino-Wireless-Bluetooth-Transceiver-Module/dp/B0093XAV4U/ref=sr_1_1?ie=UTF8&qid=1395938505&sr=8-1&keywords=Bluetooth+module

And the following USB Serial Port Adapter

http://www.amazon.com/SunFounder-Arduino-Program-Download-Mega2560/dp/B00GD6GE6O/ref=sr_1_10?ie=UTF8&qid=1395938602&sr=8-10&keywords=USB+232

First thing we need to do is configure our BlueTooth Module.

1) Power your Bluetooth Module with your Netduino

VCC –> +5V (Netduino)
GND –> GND (Netduino)

image

2) Connect your BlueTooth module to your FTDI Serial Adapter

FTDI  Netduino   BlueTooth Module
GND   GND
TX                          RX
RX                          TX

3)  Open up Device Manager, and identify the serial port that is associated with your FTDI adapter, in my case it’s COM16, yours will probably be something like COM4.  A good way to identify your adapter is to unplug, then plug it back in.  The one that disappears and reappears is probably the one you want to look at.
image

3) Download and start RealTerm

4) Configure the initial baud rate of 9600 on the “Port” tab, then press “Change” and “Open”

image

5) Confirm that your port is open and the correct baud rate is set at the bottom of the screen

image

6) If all that looks good, then we can start to configure our BlueTooth module, commands need to be sent very quickly.  The best way to do this is open up Notepad or some other mechanism where you can enter text and then cut and paste it.

a) Open Notepad
b) Type AT
c) Copy those two characters on to the clip board by highlighting them and hit CTRL-C
b) Right mouse click in the terminal area in RealTerm, and click on “Paste to Port”
c) If all goes well you should see OK

image

7) Once you know you are connected, enter the text AT+NAMEXXXXXX in notepad, where XXXXX is the name how you want to identify the bluetooth device.  No CRLF at the end.   Then copy those characters and paste them into RealTerm.

8) Then set the PIN by doing the same thing with AT+PINXXXX where XXXX is the 4 digit PIN used to pair with the device. IMPORTANT NOTE: If you use a PIN code like 1234, or 0000 your phone may try to auto-pair with that value.  To get it to work successfully in your app you will need to enter a more non-traditional code, and then manually enter the PIN code via BlueTooth settings.

9) Once you have completed your screen should look very similar to the following.  Your settings will automatically be saved to the device and you can continue by connecting it to your Netduino.

image

Connect the BlueTooth module to Netduino

10) Now you need to connect your BlueTooth module to your Netduino, you can remove the wires from the USB FDTI and connect them to the Netduino.  See PDF here for a better view of your Netduino

BlueTooth Module  Netduino COM1
RX                              PIN 1 (TX) - D1
TX                              PIN 0 (RX) – D0
VCC                           +5V (from before)
GND                           GND (from before)

11) Next up is to connect to your BlueTooth device from your Windows Phone 8.  You will have to use an actual device, not a simulator.  Hopefully you know how to do this, but click on Settings->BlueTooth, make sure it’s turn on, and find the name of your bluetooth module.  Make sure you enter a PIN code, if it automatically pairs you may have used a known PIN such as 0000 or 1234, try something different in step #8 above.

12 After you have paired your device, download the following Windows Phone 8 application and make sure you can compile it and run it on your device.  Make sure you change the name of the device in MainPage.xaml.cs to match the name of our BlueTooth Device

image

13) Then download the .cs file that has the code, to insert into your .NET Microframeworks project, the code is very straight forward, just cut and paste the appropriate parts into your application.  Also, just populate the code in your project to make the inputs from your phone actually do something.

 

At this point, your little app should be ready to run!

image

 

14) Next download the Windows Phone 8 project.

Enjoy

-twb

Friday, March 28, 2014

.NET Microframeworks Group and Windows Phone/Windows Store Apps

In our continuing serious on building an autonomous vehicle, in April we will let you robot start talking to the real world!

On April 15, I’ll be doing a session on demonstrating how to remotely control and talk to your robot from a Windows Phone and Windows Store application by adding a Bluetooth module to you robot.  And then setup some very basic protocols to control your robot with a Windows Phone and Windows 8 application. 

You'll be able to get the Bluetooth device from Amazon: 

http://www.amazon.com/Arduino-Wireless-Bluetooth-Transceiver-Module/dp/B0093XAV4U/ref=sr_1_1?ie=UTF8&qid=1395938505&sr=8-1&keywords=Bluetooth+module

To use this Bluetooth module, you'll need to configure it, to do so, you'll need some sort of USB to Serial Port Connector such as:

http://www.amazon.com/SunFounder-Arduino-Program-Download-Mega2560/dp/B00GD6GE6O/ref=sr_1_10?ie=UTF8&qid=1395938602&sr=8-10&keywords=USB+232

You can sign up at:

http://www.meetup.com/Tampa-Bay-NET-Microframeworks-Developer-Group/events/173765942/

-twb

Sunday, September 8, 2013

NiVek QC Milestone - .NET Microframeworks

Last month NiVek took to the sky in controlled flight (more or less) and was a major milestone in my one and one-half year journey back into microelectronics and flying robots :)

Over the past couple weeks I’ve been focusing on the software side of things and achieved a couple of additional milestones.  As of last weekend I was successfully communicating and configuring NiVek through the Windows 8 flight console using WinUSB.  This weekend I completed a port of the .NET Microframeworks onto the NiVek hardware.

image

image

I need to give credit to the Netduino folks for publishing their source code that helped this process considerably.  I created a custom USB stack that works with the driverless WinUSB model that’s available on Windows 8.0 and have my code running on .NET Microframeworks 4.3.  At some point, I might organize my code to provide some updates for the Netduino 2 products that are still on .NET MF 4.2.

As a mobile/cloud/client/embedded developer, I see the .NET Microframeworks as an enabler for creating small/cheap smart devices that can easily be customized to work with the cloud.  In fact, another project I have on the drawing boards right now is a programmable zone controller for our HVAC system that will be programmable with NETMF.

So what’s next for NiVek?  My final task before I have the products frameworks completed is to get the Windows Phone 8 app to a point where it can be used to fly the copter.  At that point the goals for V1.0 have been completed.

-twb

Wednesday, August 28, 2013

QuadCopter with Win8 Flight Console Talk

On August 27, 2013, I presented NiVek QC with a Windows 8 Flight Console to the Tampa Bay Robotics and Microcontroller Group.

As promised here are the materials and links.

Mounts were 3D Printed with my Afinia H-Series 3D Printer, but the Arms where from this FlameWheel kit.

Although the Windows 8 Console was built with Visual Studio .NET premium, Windows 8 Apps can be built with VS Express editions that can be downloaded for free.

The .NET equivalent to the Arudino, programmable in C# is the Netduino, they are pretty cheap and easy to get started with.  If you’re a .NET programmer and want to get started playing with hardware, this is a great place to start!

A great source of information and forums is located at the DIY Drones web site.  In addition parts and supplies can be purchased from the 3D Robotics store, I generally get most of my parts from Hobby King (they have a USA warehouse, otherwise shipping from Hong Kong is a week or two.

Finally if you don’t want to start from scratch and spend countless hours and probably thousands of dollars on parts, there are some off the shelf quad copters I can recommend.  The AR Drone 2 is a lot more than I had expected, it’s actually some very serious hardware.  You need to get some additional parts like Motors, ECS’s and a frame, but for a flight controller, you can pickup an Ardupilot APM for relatively cheap.  The firmware can be customized relatively easy.

Hope this gets you going and be sure to let me know if you get something up in the air (or have some awesome crashes in the process).

-twb

Monday, July 8, 2013

NiVek QC - Initial Flight Videos

Prior to heading to //BUILD/ this year, I took some videos of NiVek QC with my HTC 8x Windows phone, flying it with one hand and capturing video with the other was a bit challenging but I was able to get a few good snippets.

Flying NiVek is 100% accomplished with a Windows 8 app through a wired XBox 360 controller.

WP_20130617_001

The firmware running NiVek in the videos didn’t have any altitude stabilization algorithms in place.  Over last weekend, I added altitude hold as well as a “black-box” recorder that captures telemetry and allows for playback to help do tuning of the algorithms.  Hopefully this week will bring the opportunity for more flight testing.

Videos

 

And the result!

WP_20130623_021

-twb

Sunday, July 7, 2013

Fermenting Beer with a Netduino, Electric IMP and a Windows 8 App

After my new years resolution, I’ve brewed up a number of batches of beer (primarily IPA’s)WP_20130315_001 for my kegerator. Most turned out relatively good but as summer arrived in Florida it was a little difficult to keep my wort at around 70 degrees during the fermentation process. 

So I ended up investing in a freezer from Lowes for about $200 and added custom controller built from an Electric IMP, Netudino that  uploads data to a cool service called Xively.

The freezer will maintain a consistent temperature of 70 +/-1 degree, perfect for fermenting most ales. 

Here’s a screen capture from my LagoVista home automation app that shows a live capture at 30 second intervals as to the temperature in my fermenter.

wp_ss_20130604_0001

And here’s some pix on the actual controller and unit itself, note the “up-to-code” wiring SmileSomeday I might get around to putting some sort of enclosure around this.

 

WP_20130708_003

This is inside the fermentation chamber.  Note the little gray wire, that has a thermistor on the end that provide variable resistor output where we can measure the voltage and determine the temperature.

WP_20130708_004

If you’d like more info as to how to build one of these things yourself, drop me an email at kevinw@slsys.net.

As an added bonus my controller was a few feet away from my HVAC unit in the garage so I added a couple extra thermistors to to monitor the incoming and outgoing temperatures for the cooling unit. The full feed can be viewed here

https://xively.com/develop/XXKkf_vy-StrfD_YGml7

-twb

Wednesday, February 27, 2013

Next Tampa Bay NETMF Meeting/Rise and Fall of NiVek QC4

For all of you that experienced the violent death of NiVek QC4 at the last NetMF meeting, I’m happy to report that with a fresh set of propellers, all the systems checked out and I’m ready to tempt fate again with all fingers still attached.

Our next meeting is scheduled for Thursday March 28th at the Microsoft Office with social/dinner starting at 6PM and formal talks starting at 6:30. Topic looks really interesting, Joseph Bisaillon, Lloyd Sparkes, Jordi Lucero, and Sean Dunford will be discussing “Zeo Mobile Sleep Manager” and the possibilities of lucid dreaming…I’m NOT going there! Randy will also being doing an intro to using a logic analyzer to build on some of the concepts that Tim started in the last meeting.

http://www.meetup.com/Tampa-Bay-NET-Microframeworks-Developer-Group/events/104804932/

I think starting in the April/May timeframe there has been a considerable amount of interest in Home Automation, we might try to start focusing our efforts on that and get back to the hands on approach we started in the first few meetings so start saving up for some hardware! Once we get a little closer, I’ll start putting together some shopping lists.

I promise no un-controlled flight of my quad…well at least I’ll do my best to get the 1’s and 0’s in the right order and test it a little more beforehand =D

clip_image001

-twb

Wednesday, January 9, 2013

NiVek GO! QC3 – Status Update

I know it’s been a while since my last status update, but my free time is getting ever so scarce.  I think I can see the light at the end of the tunnel though.  I’ve came a long way since my measly little STM8S103 with a tiny bit of RAM and ROM and I’ve settled on the mighty SMT32F405.  This chip runs at 168Mhz, has tons of RAM and ROM and even has an FPU so I’m no longer scared into using fixed point math everywhere.

This chip is so powerful, my ultimate goal is to lay in a NETMF layer on top of the native C code controlling the Quad Copter.  Also, least we forget the initial early versions that were Netduino GO! modules, this board will also act as a GO! module as well.  One that itself is programmable via NETMF.  So bottom line is my current hardware platform will support the following configurations:

  • Stand-Alone, with either an RC Controller, a Windows Phone 8 or Windows 8 Front End.
  • Stand-Alone, but programmable in C# and controllable with RC/WP8/Windows 8
  • As a C# programmable GO! module with any of the features above.

This platform should provide a very interesting starting point to allow folks that don’t want to get in the mud of low level C and assembler programming the ability to highly customize the software.

In addition as you can see in the picture, I’ve came up with more options for telemetry.  This one uses a 900MHz radio to get get distance of 1KM+.  The other options available are WiFi, Bluetooth and XBee. 

image

Some additional “cool” things I’ve added to this new firmware:

  • Utilization of the FPU, this thing is FAST, and it also is really nice to work in float rather than scaled decimal for all the calculations.  It really cleans up the code
  • All the I2C communications with the sensors can be either sync or async.  In most cases in the past pulling the data from the sensors consisted of about 300-400 uSeconds of I2C communications followed by another 100 - 200 uSeconds seconds of processing. With the async and FPU, this went down to no time at all for the I2C transfer and usually 10-50 uSeconds.  I know a uSecond doesn’t sound like a very long time, but when you do things 200-400 times a second, well it adds up.
  • Using built in sensors FiFo (First-In, First-Out) buffers to really speed up the sample rate for the gyros and accelerometers.  These are now sampled at about 800Hz and the data pulled and processed at 200Hz.  This means each time the data is pulled we pull four samples.  This is why the async process for reading all those bytes via I2C is important.
  • I had another important realization for using the Gyros.  The Gyros read the rate of rotation, not the absolute angle/rotation, therefore the gyros outputs need to be integrated over time to get a good estimate.  In my prior version, I was maintaining the deltaT or time interval used for the integrator, this was even using a scaled decimal approach.  Basically use a timer to find the time between readings and use that as part of the integration.  With this version, I’m just using the sample rate from the gyro, that is to say if that device is internally reading values at 200Hz, my period for integration will always be 5ms, it will always be 5ms.  With an IRQ coming in, I can ensure I always can get a sample.  This is even more important with the FIFO.
  • Implemented the PID controller for all four things I care about, pitch, roll, heading and altitude.
  • Implemented a very clean complementary filter that is 100% configurable via the flight console in Windows 8
  • Implemented a generic filter method that can be configured on via the flight console to filter as either an LPF, Mean, or Moving Average.  This worked out really nice and can be used on any measurement in the sytem.
  • Almost everything in the application is considered a “sensor”.  Each sensor has a set of function pointers for different things like Start, Stop, Process, Init, etc.  Each sensor can also be configured with a sample rate.  This means each “sensor” can be treated as an abstract item that can be configured in a common way.  It’s really do some OO things in low level C.

Anyway, time to stop writing about software and continue to writing the software.  I’ve got everything I need coded, now it’s just time to desk-check everything and see if this thing actually flies.

Stay Tuned!

-twb

Monday, December 10, 2012

Netduino Serial Demo Sample

Last month we ran out of time in our meeting before I could finish up my serial data demo.  At that time I promised to get some sample code out there…all I can say is I’ve been very busy and better late than never.

The demo program I created which was called SerialIODemo is a very simple mechanism to send commands and arguments from the desktop down to the Netduino via a via a FTDI USB Serial port.

Connecting the two is very simple, just run wires as follows

BLACK  FTDI->GND to Netduino GND
GREEN FTDI->TXD to Netduino 0 (On the Digital I/O bank)
YELLOW  FTDI->RXD to Neduino 1 (On the Digital I/O bank)

Then of course you’ll need to connect both of these to your computer via USB.  The following picture should give you a good idea of how this should look.  Note the green wire is in the pin closes to end of the connector.

image

Fully Connected

image

Connection to FTDI

image

image

Connections on Netduino

After you have made your connections and plugged in the USB connections to your computer, you’ll need to check the Serial Port the FTDI is connected to. this can be done via the Device Manager under ports.  In my case, I’m on COM1

image

You’ll need to modify the code to connect to this port (TODO: Could have this configurable through the UI).  This needs to be done in MainWindows.xaml.cs in the DesktopApp project

image

Once you’ve done this you should be ready to go!

To use the app, simply make sure both programs start.  This can easily be done by right mouse clicking on the solution node SerialIODemo and setting both projects to startup.

image

Now start your program, give the Netduino a few seconds to warm up and press Connect.  When you do so, the Netduino should respond back as in the screen below.  If you don’t see this give the Netduino a little longer to start.

image

Extending the App

The idea behind this application is to invoke different commands by sending a string from the computer to the device.  The string will be in the format “command=arg”.  A switch statement in the device code will handle different commands and the args can be used to make those commands work with different “stuff” on the device.

image

image

image

Hope this gets you started on controlling your Netduino with your computer!

-twb

December Tampa Bay NETMF Meeting and Hackathon

When: Meeting - December 20, 6PM-8PM, Hackathon December 21st, 9AM-?
Where: Tampa Microsoft Office, 5426 Bay Center Dr. Suite 700, Tampa FL, 33609

Monthly Membership Meeting

This December we are going to turn our focus to having your small embedded device such as a Netduino communicate to the the Internet.  We will also be looking at the Electric IMP.  Something on the very cutting edge, but also something very cool!

This months geek shopping list

1) Electric Imp and Dev Breakout Board
2) Netduino Plus 2 or Ethernet Shield (Ethernet Shield will attach to your standard Netduino and will require a bit of hacking to get working.  We probably won’t be covering this in our meeting)
3) WiFly and XBee Shield add WiFi to your Netduino, again we won’t be covering this in the meeting but isn’t that difficult to connect and configure.  I’d be happy to answer any questions on this via Email.
4) Pen Type Multi-Meter really helpful once you really start getting into this stuff.

To register for this event, please click here.

NETMF Hackathon

In addition, as a bonus this year, Bill Reiss and I are going to be hosting the Tampa Winter Games and NETMF Hackathon all day on Friday December 21st at the Microsoft office in Tampa.  As we have seen in our nightly meetings, two hours is just enough time to get started with this stuff.  Why not make a full day of it and hang out with some like minded folks getting your “geek" on.  The format will be a couple of talks to kick the day off, you’ll get to hear Bill (great speaker!) get you going on developing games on the Microsoft imagePlatform.  I’ll also give a brief talk on something cool that runs on a very small processor.  Then throughout the day, we’ll have a series of lighting talks to cover small bits and pieces of both gaming and microelectronics.  The primary intent of these events are really just to hang out and work on some cool stuff, along with your peers that might be able to help you if you get stuck on certain areas.  I’ll probably be working on my NiVek QC1 along with some cool new 32 bit hardware and my Windows 8 Ground Station. 

I’ll bring my collection of Netduino Shields and other assorted electronics for folks to play with.

To register for this event click here.

Both events should be a blast, hope to see you there! 

-twb

Saturday, November 10, 2012

NiVek GO! QC1 – Part 6, New MCU

Since my last update about 1 1/2 month ago work client work has been extremely busy, I’ve spent a good chunk of time getting a high-end Windows 8 application ready to submit to the marketplace.  Oh and I spent a week out in Redmond at Build 2012.  Needless to say my “hobby” of building a quad copter suffered from lack of attention.

Since my last update, I did however undertake a major shift in technology.  I went from using three STM8S 8 bit micro controllers to one STM32F0 32 bit micro controller.  In a nut shell my software was working great about 99.999% of the time, however for this type of application, it really needs to be 100%.  Even a failure 1 out of every 100,000 times could be very dangerous with the sharp propellers and uncontrolled flight.  100,000 seems like a pretty high number but considering my flight control loop operates at 200 times a second, it does happen.  I think the problem is that my inter-processor communications was just to chatty, I had considerable amount of code firing and handling messages between the micro-controllers and the .NETMF host.  The communications state machines handling these messages ended up being fairly complex and very timing critical.  To achieve a 200Hz update rate, we needed to have very fast SPI communications.  To achieve very fast SPI communications the interrupt handlers needed to be very efficient.  At one point I was troubleshooting using my data analyzer and measuring the microseconds required to process the data, there just wasn’t much breathing room between bytes.

So enter new hardware and an STM32FO.  My initial prototype board also has an STM32F4 on it.  The idea is to implement the GO! Bus protocol V1.5 and have a fully functional GO! module that is self contained and performs all the functions required to maintain stable flight on the quad copter.  Then periodically send state information such as position, time, pitch, roll, heading back to the GO! main board to allow for creating command and control functionality in C# and NetMF.  This was the primary goal, but in the original three STM8S architecture, the GO! main board primarily acted as a message forwarder.

Here’s my new stand alone Hardware, the STM32F4 running NETMF is in the upper left and the STM32F0 is in the bottom right.

image

So far I have about 80% of the 8 Bit C code for the STM8S’s ported to the STM32F0.  I’m finding that unlike using the three STM8S, most of my code is actually being used to control flight, not handle communications.  It was easier than I had expected and as much as I really don’t like using Eclipse, it’s far better than the ST Visual Developer that I had been using on the STM8.  I found this great article on getting going with 32 bit development for STM using eclipse.

-twb

Tampa Bay NETMF Hacking Group

Announcing Meeting Number 2 of the Tampa Bay NETMF Hacking Group.

To register for the event, please go to http://tbnetmf1211.eventbrite.com

image

Our second meeting will also be held at the Microsoft Office in Tampa on November 21st at 6:30 PM.  This meeting will be in two parts, the first part going from 6:30-8:00 and will  be lecture/hands on.  The second part will be Show-and-Tell as well as freestyle hacking on your hardware.  If you did something cool between the meetings, come prepared to share!

After a brief recap/intro for any new members, this meeting we will explore basic communications and digital signals with your Netduino .NET Microframeworks device.  Although we will be using a NETMF device the same basic principles will apply to other microcontrollers

  • Serial Data Communications to a Host Computer
  • Serial Data Communications between two NETMF devices
  • Controlling a Servo

Here’s a relatively cheap shopping list of parts to help support your geek habit that will be useful for this meeting:

Next month, we will be exploring options for getting these small devices on the internet.  Then in January, we will be looking at the Arduino.  Anyone with experience with this want to present?

Hope to see you there!

-twb

Tuesday, September 18, 2012

NiVek GO! QC1 – Part 5, New Electronics

Over the weekend, I had time to assemble my new electronics module for NiVek.  This one had a more thought-out ground plane, a second gyro (added the STM L3G4200D to compare it’s performance to the ITG-3200) and some other small mods.  The big difference in this board however is a set of female connectors on the bottom of the board to snap onto the Netduino GO! mainboard as seen in the pix below:GO_Bottom

One of the challenges I’m going to have assembling this board is the alignment of the female connectors on the bottom of the board.  They have to be exact so the line up with the sockets on the GO! mainboard.

This new design required the creation of a development-jig to program the micro-controllers as well as hookup the data analyzer.  Here’s an ugly homemade board I whipped together to accomplish this goal until I the ones I ordered come in (note the blue/white glow from the GO! mainboard)

image

Finally a couple pictures of the final assembly, so far all the systems check out. 

image

image

 

I’m anxious to get it installed on my quad and see how it does.  I have high hopes Smile

-twb

Sunday, September 9, 2012

NiVek GO! QC1 – Part 4, Lessons Learned (to date)

Yesterday was my first public power-up demo of NiVek GO! QC1 at South West FL Code Camp.  At this point, I’m very happy with the state of all the software components created, they seem to be very stable and fairly robust and have plenty of band-width for future enhancements.  The following are the primary chunks of software I’ve developed for my Quad:

  • Three GO! modules written in C – one for reading sensor inputs at 200Hz, another for communicating via WiFi and a third for controlling motors and reading inputs from the RC Controller.  All this software is running on STM8S207’s micro controllers running at 16MHz.  These have 32KB ROM, 6K RAM and a little bit of EEPROM.
  • Netduino GO! “Command-and-Control” software written in C#.  This software communicates between the modules and really provides orchestration of all the sub processes that make up the Quad.
  • Flight Console – written in C# running on Windows 8 as a Metro, er-ah, whatever they end up calling the new style tablet apps for Windows 8.

At this point I have all the software controlling the hardware but I’m struggling with the most complicated part (at least for me to-date) in building my quad, achieving stable flight.  I’m actually getting fairly good results now with my test rig running on a single axis, but attempting to get more than a few inches off the ground and maintaining stability is turning out to be more challenging that I expect.  Remember the goal here is NOT to use the RC controller to control the pitch and yaw, but to measure the error and then update the power to the corresponding motors to compensate for those errors.  The RC controller (and eventually the Windows 8/Windows Phone apps) will be used to send a command to the “fly-by-wire” system of the quad.  Then the quad will figure out what it needs to do to make those commands happen.

Lessons Learned and Next Steps -

Noise on Accelerometer

One of the biggest differences I’m seeing between just developing the software on a development board and using it on the quad with the motors running is the amount of noise in the accelerometer.  With a low pass filter of about 10Hz running, I’m seem very stable output from the accelerometer without the motors (+/- 0.25 degrees).  With the motors running, I’m seeing unacceptable noise of about +/- 10 degrees.  Since gyro is extremely stable and the accelerometer is only used to compensate for drift, the accelerometer doesn’t have to be super accurate and noise free, but it does have to be better than +/- 10 degrees.  I haven’t tracked this down to be electrical or mechanical, however here are my next steps to minimize the noise.

    1. I have some new boards coming next week where I spent considerably more time thinking through the ground plane and adding bypass capacitors.
    2. My current quad frame is plywood, I’m going to try a different one that is aluminum with a carbon-fiber deck for mounting the electronics.
    3. Add some small rubber washers to attempt to isolate the electronics.
    4. Add some small rubber washers to connect the motors to the frame.
    5. If I’m still seeing the noise, I’ll take a look at balancing the propellers.

Update rates on the ESC.

I’m currently using the stock firmware on the ESC (electronic speed controls) that are used to take the output from the micro controller and power the motors via PWM.  The stock firmware only allows an update rate of 50Hz to control the motors.  In addition, after doing some research, I’m seeing that this is even filtered a bit more and I might only be getting about a 20Hz update rate, this really doesn’t seem fast enough.   I found a great post on RC Groups that discuss how to flash new firmware on my ESC’s that should allow for a faster update rate.  This still uses PWM but looks like it might allow and update rate of 400Hz which would be fast enough for the system to grow into. 

As a couple sides notes on this:

  • Since it looks like I’ll probably end up flashing the ESC’s I might look to using something other than PWM to communicate with the speed controllers.  It doesn’t seem like it might be all that much of a stretch to go to I2C or even something really crazy like using a custom GO! module with some FET’s, but this probably won’t be something that will happen in the near future.
  • The firmware I’m going to flash is actually written in assembler.  It probably sounds crazy, but I really wouldn’t mind getting my hands dirty and seeing what I can do to really make my ESC’s play nicely with my GO! module.  I never thought I’d see the day when I would have the need to write assembler again.
  • Right now I’m only using 100 graduations from idle to full throttle.  That is to say I can only specify an integer value of 0 to 100% to control the PWM and thus the speed.  My initial gut (which is usually correct) says that resolution is probably the best I can expect from the ESC/Brushless motor combination.  However now that I’m seeing the quad in action with the motors running, it almost seems like small difference actually make a bigger difference in the RPMs.  I might want to do some tests, I’m thinking I can use some sort of IR Sender/Receiver and a little app that counts pulses, then I could measure the RPM of the propeller and see how it response to different inputs.  This would also be very “interesting” from a before-and-after perspective of updating the firmware on the ESC’s.

 

Allow for additional configure of the sensor and GPIO module.

  • The accelerometer and gyroscope have some register based settings to control things such as filter frequencies and update rates.  Right now these are set as constants in the firmware.  These can just as easily be read from the EEPROM after being programmed from the flight console (similar to how the PID values are being configured).
  • The accelerometer has a high-pass filter implemented on the STM8 that should be configurable via the flight console.
  • The complementary filter has some constants on how the Gyro-scope and accelerometer are combined.
  • There are at least two common approaches to combine the gyro and accelerometer.  I chose a complementary filter since it was easier to implement and doesn’t require as many CPU resources as a Kalman filter.  Since it looks like my little STM8’s aren’t working that hard, I might go ahead implement the Kalman filter or investigate the “Extended Kalman” filter has demoed in this video.
  • Right now the PID constants are linear.  That is to say, the P or proportional component applied to the error is the same if the error is 20 as it is if it is 2.  Might want to consider having two sets of PID constants, one for “really-bad” errors, this will probably only use the P component.  Then when we get to the point where we want to fine-tune the correction factors, have a different algorithm or set of constants.

I have a fairly large client deliverable due in September but hope to have the majority of the items completed by the end of the month.

-twb

Thursday, September 6, 2012

NiVek GO! QC1 – Part 3, Test Fixture/PID Controller

In my continuing effort to get my .NET quad copter off the ground, I’ve created a quick video to demonstrate the test fixture and software I’ll be using to achieve staple flight.

Enjoy!

NiVek GO! QC1–PID Tuning Fixture

-twb

Tampa Bay – .NET Micro Framework Development Group

Today I’m announcing the first meeting for the Tampa Bay – .NET Micro Framework Development group on Thursday October 18th, 2012 at the Microsoft Office in Tampa.
image
If you’re interested in learning more about controlling hardware for software, even if you have no experience, please join us!  You can read more about the .NET Micro Framework.
These will be the primary goals of the first six months or so of the meetings (which are open for discussion):
  • Setting up development environment, the hardware and software you will need.
  • Very basic digital electronics, how to flash an LED, how devices and components talk together.
  • Communicating with a Windows 8 and Windows Phone front end.
These meetings will be part “lecture” where we’ll discuss some basic concepts and potentially do some hands-on exercises as well as “show-and-tell” that will let folks do quick demos of fun stuff they are working on.
To start out with, we will be working with the first generation Netduino, so if you are interested in hands-on participation, you might want to order one of these before coming to our meeting.
Even if you have zero experience, but have an interest in this kind of stuff, please come and join us!  It really is an awesome experience bringing hardware to life with the software you write.
RSVP Now
-twb

Saturday, August 25, 2012

NiVek GO! QC1 Video – Part 2

Here's another quick and dirty video of NiVek GO! QC1 a .NET Microframeworks application with a Windows 8 (and coming soon Windows Phone 8) Flight Console

In this one, I'm spinning up the four motors on the quad copter although I'm a little timid to try to fly it in the cramped quarters.

 

As noted in the video, I'm seeing a lot of noise in the accelerometer when I power up the motors, but the gyro is clean.  Using a complementary filter I'm getting decent attitude readings (pitch/roll), but it's still bouncing around a couple of degrees, if anyone has any suggestions on how to isolate and cleanup the problem, I'd love to hear them :)

Next up is hook in the pitch/roll or error information into the PID controller and see how it flys.

Stay tuned!

-twb

Wednesday, August 8, 2012

NiVek GO QC1 Makes its debut at Tampa Windows 8 User Group Meeting

On August 8, 2012, the NiVek GO! QC1 (Quad Copter1) built with Microsoft .NET technologies will make it’s debut at the Tampa Windows 8 User Group meeting. 

image

You may ask what does a Quad Copter have to do with Windows 8?  Well, the flight console as pictured below runs on a Windows 8 Slate.

image

Not 100% a metro app, but it’s not a typical application either Smile

The “brains” or flight computer behind the quad copter is really in four parts.  Yes, that’s right there are four processors use to power the copter. First is a board I designed that has 3 STM8 chips a bunch of sensors and some EEPROMs used to keep data when the power is pulled.

image

The second is the new Netduino GO! board

image

You can see how they are connected in the following picture, via something called SPI.

image

Do you really need four processors?

You may ask, does it take four processors to drive a Quad Copter.  The answer is: well probably not, however a quad copter is inherently unstable and it does require a good amount of processor power to provide a “fly-by-wire” mechanism to keep it stable.  The idea here is to use a modular approach where each processor has an assigned responsibility, it does only one or two things and it does them very well (or what’s important here, very fast on a very highly predictable time frame).

What do each processor do?

GO! Main Board – The Netduino GO main board provides orchestration of flying the copter.  The software for this is primarily written in C# running on the Microsoft .NET Micro Framework. Not really time critical things but more strategic.  Things like routing messages between the different modules.   Considerably more on this to come in future posts

Sensors Module – It’s one responsibility is to figure out the attitude of the quad copter, that is to say the pitch, roll and yaw.  This also has sensors for altitude and a GPS.  The sensors in the first generation of my board are a 3 axis gyro ITG3200.  A 3 axis accelerometer and 3 axis magnetometer (electronic compass) LSM303DLHC.  A sensor to measure air pressure (which can be used to accurately determine altitude) BMP085.  And finally a fast GPS module (10 updates per second) UP501.

Flight Control Board – This really has three main functions:

  1. Quad copter is flown by a standard Remote Control transmitter.  The first task of the flight control board is to take the PWM (Pulse Width Modulation) from the receiver and turn it into inputs for the flight control computer.
  2. Next step is the fly by wire algorithm.  This takes the current attitude (how much the quad copter is tilting in the X/Y plane) and combines that with the input from the RC receiver and figures how how much power needs to be applied to each motor to keep the Quad Copter from crashing.
  3. Finally the Flight Control board takes the power to be applied to each motor in the form of a percentage and changes that into another PWM signal that is applied to the ESC (Electronic Speed Control) that controls the brushless motors.

Telemetry Board – The primary purpose of this board is to establish a link from the on board computers back to the Windows 8 (and eventual Windows Phone 8) consoles.  This uses the RN-171 WiFi module and an STM8S207 chip to provide these services.  This modules purpose is very simple, take a byte array in very quickly via SPI, buffer it and then send it out via WiFi.  It also listens for commands from the flight console and relays them to the GO! main board for processing. 

Couple final pictures

imageThis is the control board mounted on the Quad Copter Chassis.  The white stuff is the Gorilla Glue I used to hold everything together.  Didn’t realize how much of a mess it would make Smile with tongue out.

 

image

Close up of the Brushless motors and the 10” propellers.

What’s next?

Tonight I only have a brief amount of time to cover this project, for a more detailed run through of the hardware/software, please attend my session at the SWFL Code Camp in Napes on September 8.  I’ll probably be flying it over lunch.

In addition over the next couple of months look for many more posts along with the publishing of the hardware and software for the NiVek GO! quad copter platform.

Until next time!

-twb