dgcaste

Forum Replies Created

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • in reply to: Synchronizing 3 Video Sources #2021
    dgcaste
    Member

    The VE+Arduino combo uses almost every single Arduino resource that’s available, including interrupts and timers. The TV libraries can read the video signal in black and white (not even grayscale) by comparing every single pixel voltage against a reference voltage. The libraries also allow you to write onto the screen. Complicated logic is pretty much out of the question. Maybe try the Raspberry Pi?

    in reply to: Overlay will suddenly disappear when using Object Tracking #2020
    dgcaste
    Member

    Is there one of the three timers that’s free with these libraries that I could use as a PWM? Or should I have an external reference voltage source?

    in reply to: Video tearing left to right #2018
    dgcaste
    Member

    @Andon wrote:

    I’m only beginning to work with arduino, and coding in general. Any chance you could put the code up for me to take a peek at?

    Sure. In your setup() function, just add these two lines in between the brackets:


    initOverlay();
    initInputProcessing();

    Then outside of the setup() and loop() functions, declare what those two functions you just added are:


    void initOverlay() {
    TCCR1A = 0;
    // Enable timer1. ICES0 is set to 0 for falling edge detection on input capture pin.
    TCCR1B = _BV(CS10);

    // Enable input capture interrupt
    TIMSK1 |= _BV(ICIE1);

    // Enable external interrupt INT0 on pin 2 with falling edge.
    EIMSK = _BV(INT0);
    EICRA = _BV(ISC11);
    }

    void initInputProcessing() {
    // Analog Comparator setup
    ADCSRA &= ~_BV(ADEN); // disable ADC
    ADCSRB |= _BV(ACME); // enable ADC multiplexer
    ADMUX &= ~_BV(MUX0); // select A2 for use as AIN1 (negative voltage of comparator)
    ADMUX |= _BV(MUX1);
    ADMUX &= ~_BV(MUX2);
    ACSR &= ~_BV(ACIE); // disable analog comparator interrupts
    ACSR &= ~_BV(ACIC); // disable analog comparator input capture
    }

    Note: it may be unnecessary to declare and call initInputProcessing() depending on your code. If you’re running the NTSC Demo, there is no input processing done, and all this function does is set up the analog comparator in order to compare input voltages to reference voltages. I put both functions up because you would need them for other sketches that use the full capability of the VideoExperimenter board.

    Note2: since you’re learning, what these functions are performing are bit-level operations on the ATMega microprocessor. The funny looking operators are bitwise operators: http://en.wikipedia.org/wiki/Bitwise_operations_in_C

    in reply to: Overlay will suddenly disappear when using Object Tracking #2012
    dgcaste
    Member

    Okay. At 5V, with a 10k resistor and a 10uF cap I can get about a .02 delta V from peak to peak (http://sim.okawa-denshi.jp/en/PWMtool.php). Do you think that would be stable enough? Then I can adjust the duty cycle of the PWM to adjust the cutoff voltage for pixel brightness.

    Since the Arduino doesn’t run at exactly 5V unless the voltage regulator is awesome, would the TVOut library be compatible with sampling the input voltage so I can read the analog input from the PWM to ensure that it’s simulating the correct voltage? I ask because the most accurate methods I’ve found for sampling voltage involve using the Arduino 1.1V reference, which in turns requires the use of the analog comparator. (e.g. http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/)

    in reply to: Overlay will suddenly disappear when using Object Tracking #2005
    dgcaste
    Member

    I understand, if I were able to squeeze a little bit more it would do everything I sought to do with it. And if I can’t, I’m still super satisfied because it’s taken me farther than I ever will with an Arduino.

    Is there a way to figure out what reference voltage is going into the analog comparator? Or is there a way to give the Arduino a reference voltage manually by feeding the comparator with a PWM?

    in reply to: Overlay will suddenly disappear when using Object Tracking #1995
    dgcaste
    Member

    That’s possible, I don’t know how strict my video source is. I’m using a Nikon D5200’s AV output. I have a CMOS camera I bought from eBay that I’m not using because I forgot to get a BNC cable at Fry’s but tomorrow I’ll try it.

    I get your point about the missing underlying OS managing exceptions. Maybe there was some remnant on the bootloader left behind to do that sort of task, but I suppose that would be poor design on a hobbyist kit with very limited resources. I could also see advanced programmers wanting to reclaim those resources back if such a thing were in there.

    I’ve heard of people using Microsoft Visual Studio to run advanced debug tools on the code, maybe I can use those to peek behind the scenes? I’m afraid the need for timing to properly capture frames would break with breakpoints and the variables wouldn’t represent actual values from a clean runtime.

    in reply to: Video tearing left to right #1989
    dgcaste
    Member

    Turns out that adding the initOverlay() and initInputProcessing() function calls to setup() fixed the problem.

    in reply to: Overlay will suddenly disappear when using Object Tracking #1988
    dgcaste
    Member

    I’m not. It was using the vanilla sketch from the site. I added the on pixel count thing later then took it off.

    Is there a way to use pollserial to send exceptions thrown out the serial port?

    in reply to: Overlay will suddenly disappear when using Object Tracking #1982
    dgcaste
    Member

    Has anyone figured out what is causing this buffer overrun? Another piece of evidence that lends to this theory is that I added to the program size by keeping track of the amount of pixels that were “lit” (I used a count++ for every pixel that was found to be “true” in the x,y loop). This made the program crash after a few seconds instead of the usual minute or so.

Viewing 9 posts - 1 through 9 (of 9 total)