Asked — Edited

Adc Value Monitor (Read Adc) Overload

Hi all,

I "was" having major performance problems within ARC that was getting worse and worse. The program would lag badly and sometimes lock up and crash. It was driving me nuts. Window 7 was not effected but I could not decide if it was my laptop, win 7 or EZ-B. The problem got worse to the point I couldn't even click on a button or drag a window around within ARC and have it react. Then EZ-B would lock up and the program would crash. I tried to have just ARC running and nothing else. However testing showed Win 7 and other programs would stay up and work nicely. Then I realized that the problem had gotten worse as I added ADC port Value monitors from the Add Control feature. I have 9 ADC Value monitors running now and all were watching different ADC ports on two different boards (I plan to add more soon). Once I clicked the Pause box on all but a few ADC monitor windows all my problems went away and ARC ran perfectly! No lag, no crashes.

Is this usual behavior? Seems like monitoring ADC poets is very intensive for ARC. However when the lagging problem was occurring I was watching a CPU monitor and EZ-B was only using about 60% of core 2 of a dual core CPU. Has anyone else had this issue running more then a few of these monitors? Would a stronger laptop with a better graphs board run these monitors better and without lag? I'm running on an older Dell laptop with a duel core Intel Centrino now.

Now, it's not an issue since I paused most of the monitoring windows. Also now that my B9 project is mostly setup and working without issue I really see no need for the 9 or more ADC monitor windows. But they're really cool to watch as B9 is run by EZ-B.

Thanks, Dave Schulpius


ARC Pro

Upgrade to ARC Pro

Unleash your creativity with the power of easy robot programming using Synthiam ARC Pro

PRO
Synthiam
#1  

It's the communication channel. If you flood it by having too many requests, the software will suffer. If you are monitoring ADC and using ReadADC() in scripts, then you are executing twice as many communication calls, which affects performance twice as much.

Remember, when the GUI is running a "read" command from the EZ-B, it has to wait until the command is read and the value is returned. The process can only be as fast as the communication channel. You may use the Benchmark Control to view the communication performance on your computer.

To monitor the ADC, do not use a graphical ADC window - instead use the Variable Watcher to view the results of your ReadADC() commands.

#2  

Ahh, that splans it. Understood. :) I also have a Variable Watcher installed to view results and that works just fine for my needs. I'm learning, slowly.

Thanks!

PRO
Synthiam
#3  

You're doing great :D

#4  

I kinda had the same issue when I was setting up the battery monitor for Phil, it was polling for voltage as fast as it could run the script, until I added Sleep(1000) to the loop so it only polls once per second...which brought me down from 70% to 15% cpu load lol:D I'm using win7 ultimate on an Atom n270 1.6ghz netbook with 2gb of ram....its not fast, but its very functional:D

:Start

Sleep(1000) $Battvolts = GetADC(adc0) * 0.0392079031372549 If($Battvolts < 7.10) ControlCommand("Soundboard", Track_1) Goto(Start)

#6  

thanks for the "workaround" kenny. and DJ for his ever tech support! Its good to know that intensive ADC monitoring without a "sleep" can be taxing. If I might ask Dave , what are/were you doing with so many ADC monitors(enquiring minds :)

#7  

irobot58 ,

Sure, I'd love to explane:

I have 10 chest buttons on the front of B9. All are connected to momentary switches that are in turn connected to a CFSound III sound system. The cool thing about the CFSound III is that it has onboard relays that you can program to close when a momentary button is pushed and a sound file is played (on a compact flash card on the CFS III). Anyway, I have 6 ADC poets connected to 6 of those CFS III relays. one wire is from the 5vdc pin and the other is the signal pin. So when I push any of the 6 chest buttons assigned to the relays tied to the ADC ports on EZ-B, EZ-B sees the change of voltage. I can program EZ-B to execute a script that's watching that ADC port. So in short I've tied the CFS III to the EZ-B through 6 of the 10 chest momentary buttons. Does that make sense? ;)

The other 4 buttons make things happen with the CFS III like playing sound files randomly and timed randomly, play a different sound file at each button push, start up my on board Bluetooth receiver that hooks up to my laptop so I can run a program that lets me control what B9 robot phrases he recites. The 4th button will start the soil sampler and any animation other I choose to program into EZ-B.

The other ADC ports are monitoring potentiometers that give feedback for the positioning of where DC motors are.

Hope you got all that.

Dave Schulpius

PRO
Synthiam
#8  

Dave, you could get creative and put a different value resistor on each switch and use only one adc port:) that'd be neat - but not entirely necessary lol

#9  

thanks DJ i did not think of that :D

#10  

humm, got to try that. I actually was wondering how to come up with another ADC port. I only have one open port on one of the boards and will need at least 3 more.

How would I make GetADC() see the different values in a different scripts? would I just specify a value where each resistor brings the voltage to on that port?

#11  

Thanks for sharing Dave your totally understandable explanation and sounds like DJ is coming up with a creative way to minimize ADC ports. Sounds like a small SDK script using IF GetADC() > ( a value) Elseif(action1) etc.......I know, a bit of programing:) but I believe you have done a little before , using given examples and converting them to your more specific needs. I have definately done that and learning along the way :)

#12  

@username - irobot58,

Thanks for the script hint. Yes, this sounds like it may be the answer. I'm certainly going to give it a try.