Forum Replies Created
-
AuthorPosts
-
MichaelKeymaster
And how would you propose accomplishing all of that on an ATmega328 microcontroller? The reason it can’t do more than it does is because there is only 2K of memory in the Arduino, and you can’t generate the composite video color burst with a 16MHz clock speed. There’s only so much you can do with an Arduino.
MichaelKeymasterYes, you need all that code to enable overlay capability. I don’t know why your program behaves differently depending on the camera signal. That should not affect the timing.
MichaelKeymasterI think you are asking the nunchuk for data way too fast. Slow this whole process down by adding a delay with tv.delay_frame(1) or delay(100). Look at the TVBlaster code and see how it only asks for more nunchuk data on even numbered trips through loop(). Just slow way down and give the nunchuk a chance to process your request.
MichaelKeymasterAlec,
Basically, using an I2C device with the Video Experimenter is tricky, and sometimes the timing doesn’t work out. Are you using the Hackvision Controllers library for your I2C nunchuck communication? I remember having the same phenomenon where the nunchuck would drift up, and I remember fiddling with the order of the code until it became stable. Sorry, it’s just really hard to use an interrupt based protocol while generating video. The Arduino isn’t too powerful in this regard.
MichaelKeymasterYes, I think you can get that to work. The nunchuck timing is the hardest. Pollserial should work fine with the XBee radios. Good luck!
MichaelKeymasterYou are correct about I2C and video. I re-implemented the I2C lib for Hackvision mostly to cut down on memory consumption (the original Wire library uses big 32 byte buffers). Look at this project http://nootropicdesign.com/projectlab/2011/03/20/tv-blaster/ to see how I only do I2C communication during the vertical blanking interval. Timing your I2C communication during this time slot is the key. If your I2C communication is quick, then you may be able to make it work. It is tricky, though.
Yes, you can do normal analogRead while using the Video Experimenter. Just don’t use A2, as that is used by the VE board.
MichaelKeymasterResistor R2 is 330 ohms
MichaelKeymasterAre you saying you want to use an Arduino + Video Experimenter to analyze the video to determine when a goal has been scored? I think that’s a bit beyond a $2 microcontroller.
MichaelKeymasterdo you even know if your RTC works? Have you written a program without any video that reads the RTC?
To debug a program, gradually introduce new functions and see when things go wrong. Take out the timer2 incrementing. Does the time display?
Do you know for sure if your timer2 increment() function is being called?
Have you tried introducing a delay in loop()? Your program doesn’t need to constantly update the screen. Once per second is enough.
In short, figure out which of your code is even running at all, and gradually introduce more code. That’s all I can tell you at this point.
MichaelKeymasterWhat do you mean by “doesn’t work”. You gotta provide information.
MichaelKeymasterYou can look at the DefusableClock program. This device is a clock implemented in Arduino code. It uses timer1 to tick every 1 second, but you’ll need to use timer2. Timer2 is an 8-bit timer, so you need to “tick” more often than one second. Use a prescalar to adjust how often the timer2 counter increments. See the ATmega328 datasheet for that.
Defusable Clock code is available here:
https://nootropicdesign.com/defusableclock/hack.htmlSorry, I don’t have the time to write it all for you. Every week I get a dozen requests to write code for people, and I just can’t possibly do that. Full-time career, running an electronics company on the side, family, etc. I hope everyone understands. nootropic design is a one-man company.
MichaelKeymasterYou are using a variable that is never declared. Whichever program you got that line of code from, you need to carefully study how that program works and ensure that you are duplicating the right logic, including the variable declarations. Make sense?
MichaelKeymasterYou could read the time from the RTC before starting your video stuff. Then use the Arduino to keep track of time after that. The Arduino itself can keep fairly accurate time. Use Timer2 because Timer1 is used by the video. Using timer2, you can set an appropriate prescalar to run an ISR every 100ms or something like that, and keep track of how often the ISR fires, therefore incrementing the time.
That’s not a beginner approach, but can be done if you know how the microcontrollers timers work and how to use them.
MichaelKeymasterYes, you can power it from a 11.1V battery. A 7.4V battery will probably also work, so give it a try. You won’t break anything.
If you want help with your coding issue, post the exact error messages you are getting from the compiler.
MichaelKeymasterYou can’t use anything requiring interrupts with the video experimenter. So, you can’t use Serial (use the pollserial implementation that is part of TVout). How does the RTC library work? If it uses interrupts, then the precise timing needed by TVout is going to interfere.
Basically it takes all of the Arduino’s capability to generate a video signal, so interfacing with other complex hardware is always going to be very challenging or impossible.
-
AuthorPosts