Electronics > Beginners
Building a two channel counter - problems when using two channels but not one.
(1/1)
threephase03:

Hi All

I'm building a two-channel counter which counts pulses from an energy meter. I'm using One Teensy 3.6 for control & comms & Two Teensy 3.5 as the counters. The system works fine when I am counting one channel at a time but when I connect two they interfere with each other and don't deliver the correct results 

the counters output 3V and as it gets pulsed it interrupts a pin and adds 1 to the counter

Is there anything obvious I am overlooking?

Thanks for taking a look


 

 
Signal32:
Why not just use a single teensy to do all the counting & comm ?

I will assume there is a valid reason for that. Questions to give more details about problem:
 - Have you tried running the teensies at 3.5v - it may be a signal level issue.
 - What is each teensy doing, who is keeping track of the pulse count - master Teensy 3.6 or Teensy 3.5 ?
 - Is the output from the slave teensy 3.5 always good and the comm Teensy 3.6 messes up - where does the counts get corrupted ?
 - How do the counts get corrupted, what issue are you seeing - what is expected result ?
rstofer:
I'm just guessing that the problem is in the center Teensy as it seems to be getting serial messages from the two clients.  What you didn't say is whether you have proper interrupt driven IO going into queues or were trying to do it with polling which is likely to fail.

Post your code for the master and the slave.
iMo:
With a single Teensy 3.5/3.6 you have to be able to count 2 channels at 10000 pulses per second and do the communication in parallel without a single count lost.
Rethink your design..
PS: for example with 2 interrupts for channel A and B, rising or falling edges of the pulses increment ie. 64bit counters counter_A and counter_B inside an ISR_A and ISR_B (interrupt service routine).
In parallel you can do what you want.
threephase03:
Sorry for the late reply, i had to start a different project and only just getting back to this one.
I know when the pulses are going to come. So I'm not communicating with it while its counting.

I'm going to try and put opto's in to isolate each board from each other and see how that goes.
Navigation
Message Index
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod