Netduino home hardware projects downloads community

Jump to content

The Netduino forums have been replaced by new forums at This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

Ahmed Atlam

Member Since 25 Sep 2012
Offline Last Active Jan 12 2013 05:29 AM

Topics I've Started

High Resolution Quad Encoder Problem

25 September 2012 - 11:32 AM

Hey guys !
I am new here, first post ! I am a meng, so code and electronics are not really my strengths, but I know a few things from research and several projects. I am using a Netduino Plus for this project. It has some PID control and DAQ.

The Problem

I am currently stuck with a 1200 dots per rev shaft encoder. Its a quadrature encoder, giving a phase A and B. I managed to build a decoding circuit (flip-flops,AND & NOR gates) and now I have 2 wires that give pulses for each direction of rotation. I do NOT have a dedicated counter so I am using the pulses to interrupt on GPIO of the netduino (is that wrong? ). Interrupt ports work fine ( position ++; ) however, I need the netduino to be constantly monitoring the process set value through the ADC. That means a while(true) loop and here is where the interrupts from the encoder stop working because the processor is stuck in the loop. If I break the loop, interrupts work fine, but it is no longer monitoring the set value.
I also run into ALOT of out of memory exceptions ( without even adding the print to console to start graphing), specially when the motor starts going fast ( crashes asa duty cycle goes above 45).

Options I tried to consider with no luck:

1) send the the required set values through USB instead of an Analog signal

2) send the values over TCP :
Would love to, as it adds wireless control feature, easily interface with matlab DAQ and simulink. However, I need alot of help coding that (code examples appreciated). Also I was advised that this will consume memory very fast.

I think my major problem is that I am used to matlabs xpc, so memory and sampling times were almost never an issue, plus multi tasking and threading / multi core support was also available so monitoring multiple variables and updating multiple varriables at the same time was not an issue either.

Please help, any advice is much appreciated and welcomed !!
Thanks in advance !!

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.