I've been interested in pursuing a few projects with timing requirements that exceed what the Netduino can do for me, but I am intent on keeping Netduino/NETMF/C# at the core of these projects. A few weeks ago I posted a query about CPLD shields. I eventually settled on the Amani GTX and am so pleased with the results that I thought it would be worth sharing some info here.
The project I completed this weekend measures the velocity of flying projectiles. These are usually called "chronographs" and are used in archery, airsoft, and shooting hobbies. The basic idea is to use two optical sensors spaced some distance apart (say 2 feet) to measure the transit time of a projectile. When the first sensor fires, a timer starts. When the second sensor fires, the timer is stopped.
I used two CED M2 sensors. CED manufactures chronographs and sells these sensors individually as replacement items, since people tend to accidentally shoot them when trying to fire just above them. They have a 20ft cord with a 3.5 stereo audio jack, which I figured I'd just plug into project. I'd imagine there are lots of projects other than chronometers that could use these sensors -- at one point I was measuring the RPM of a box fan with one, while figuring out how it worked.
I cracked one open and it seemed like it took 9V, regulated it to 5V, and returned a 5V signal. Hooked one up to 9V, connected my DSO Nano V2, and learned that it sent a 5V digital signal, going low when something passes and casts a shadow onto it. (I've read that the DSO Nano is a "toy", but I get a lot of mileage out of it).
So, this is where the real problem begins. If a projectile is traveling at 2400 fps and the sensors are 2 feet apart, the time between first and second sensor detection is on the order of 800 uSec. If there's a way for the Netduino to reliably measure that with a resolution of about 1 uSec, I don't know what it is. So, this is where the Amani GTX comes in.
It comes with 'duino headers which aren't seen in the pic above. I soldered them in and stacked it onto my project. Then I whipped up a little "pmod" with 3.5mm jacks. This is how the sensors connect to the Amani GTX.
I'm told that this would have been OK for the Amani, but I decided to add resistors to divide the sensor voltage from 5V to 2.5V before actually trying it -- pictured is the version without the resistors. So, the sensors plug into my "Pmod", the "Pmod" plugs into the Amani, and the Amani plugs into the Netduino. Now I needed to configure the Amani.
Since the Amani GTX is based on an Altera Max II CPLD, I used Altera's free Quartus II and ModelSim tools for creating, testing, and deploying designs. I decided that the design would communicate back to the Netduino via serial, so I designed a simple asynchronous serial transmitter in Quartus, as part of the design. The pros will probably laugh at my design, but here's what I did, just to give an idea of what it's like to work in Quartus:
The bottom line is that I'm now able to measure the time between sensor hits to about 1/4 uSec and those times are shuffled off to the Netduino via serial. It all works like a charm and if I ever decide that I want to use the Amani for some other project, I can reconfigure it with new application-specific logic. But I've got more to do with this project, first. For instance, I'm going to add Digilent's PmodAD1 (12 bit ADC, shown below) and an Amani RAM daughterboard to solve a problem I originally raised in this thread. Should be able to measure the projectile transit times and log strain gauge data (at 1 million samples per second) simultaneously, on the Amani.
Well, I hope that made sense... It was a sort of stream-of-consciousness post, but I have been really pleased with CPLD and the Amani GTX and wanted to share something of the experience. Hope this info might be useful to others on the forum.
P.S. I have no connection to Amani, Digilent, Altera, Seeed Studio, SparkFun, or CED other than being a satisfied customer of each.
Amani GTX + Netduino Plus
Started by Spork, Apr 16 2012 02:20 AM
3 replies to this topic
#2
Posted 04 May 2012 - 06:52 PM
I'm not usre I fully understand all of this but the Amani GTX is like a FPGA device onto which you can program all sorts of really fast logic functions?
Could you give some more useful examples of what the Amani GTX can be programmed to do?
While the DSO Nano surely is enough in some applications, it is far from sufficient as a general purpose oscilloscope .
#3
Posted 24 May 2012 - 02:51 AM
I'm not usre I fully understand all of this but the Amani GTX is like a FPGA device onto which you can program all sorts of really fast logic functions? Could you give some more useful examples of what the Amani GTX can be programmed to do?
Yes, CPLDs are similar to FPGAs. There's an architectural difference between the two but (as far as I can tell) everything I've learned working with the CPLD is portable to FPGAs. I chose the Amani GTX because I liked its form factor and the Altera tools. One web page described CPLDs as "virtual breadboards", which appealed to me because I was in the process of building this project out of 7400 series components -- building the same design *inside* a CPLD seemed a lot simpler than buying parts, designing a PCB, etc. Altera's tools include a library of components that mimic the 7400 series, so that's where I started. By the end of the project, I had started creating my own components using Verilog.
There are a number of example projects here and here. Have a look at "Arduino SRAM Expansion: Supplemental Address Injection and Packet Interception".
#4
Posted 24 May 2012 - 10:02 PM
This appeals to me too...described CPLDs as "virtual breadboards", which appealed to me...
I'm very impressed by your work here. Some more questions if I may:
1) Did you realize the above schematics completely in the CPLD?
2) Was it hard to set up a working development environment, i.e. toolchain and begin implementing circuits like the in the schematics
3) Are there many libraries implementing common chips and circuits?
4) Have you worked with other CPLDs or FPGAs prior to this?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users