Remote control

Store Forums Lumazoid General Discussion Remote control

This topic contains 6 replies, has 2 voices, and was last updated by  Michael Krumpus 10 months, 3 weeks ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #8560

    Vadpol
    Participant

    Hi there!
    Just thought about adding of the IR sensor and portable IR control instead of pots and buttons. It might be handy especially during parties in order not to mess around to change the pattern or band with knobs and buttons. It will not make it more expensive as this set of universal IR control and sensor costs around 2-3 bucks at AliExpress for example. I belive that it will not require big effort to update schematics and code a little bit but will make the usage much more convenient. What do you think?

    #8563

    Michael Krumpus
    Keymaster

    That is a good idea, and I have considered it. The problem is that the Lumazoid is 100% busy sampling the audio and then running the analysis and updating the display. I think that if you added the code to read the IR sensor, it would disrupt all of that. I have experience using IR sensor + remote on other projects, and the code requires precise timing and interrupts to determine the incoming IR code. I don’t think you could do that without disrupting the Lumazoid’s smooth function. Make sense?
    Definitely a good idea, though.

    #8568

    Vadpol
    Participant

    Hi Michael,

    Thanks for your quick response! I like what you are doing, that’s something I was always interested! I do realize the issue of real time calculations if capacity is limited… There are two ways to solve it I believe – to increase capacity (i.e. using of the more powerful processor – ARM Cortex core based f.i. or to make part of the calculations – FFT analysis – by hardware, a small MSGEQ7 chip could do it). But both will require more investment of course which is not in line with your initial intention, right? However every product has its consumer, maybe this is something for the future development 🙂
    Also in order to increase sensitivity the good idea might be to use a simple circuit based on cheap LM386 amplifier at the input of existing schematics after stereo signal joint. This will make the device more sensitive to the line input and – the most important – to the mic module you’ve indicated somewhere already. This will eliminate the necessity of wire connection and thus give a flexibility in installation at any corner of the room. If you are not against I will try to make a prototype of this based on your initial design and share the result with you. I hope that it might make the usage of the device more convenient as well – just trying to make it more customer friendly 🙂

    #8570

    Michael Krumpus
    Keymaster

    Yes, by all means give it a try! In designing a product, it is important to keep the hardware as simple and cheap as possible. That is why I did not include an amplifier. The sensitivity control should allow you to turn up the sensitivity high enough for line-level input.

    #8692

    Vadpol
    Participant

    Hi Michael,

    First of all – all the best in the New 2017 Year! Merry XMas and Happy New Year! Sorry for being silent for a while, but in the meantime I’ve managed to make a through hole PCB design by using just of standard mockup type of it, no customs made yet. Therefore I made some electrical connections just by thin wires at its backside. Also I used LM386 preamp and put IR sensor TSOP3848 connected to D6 digital pin of AtMega328PU chip for the future developments (still think about it). Everything I put in the small plastic box with two potentiometeres and two buttons in front and two parallel LED outputs and audio in and out jacks at the rear. It works very good! The device started to be much more sound sensitive, also it has a small built-in electret mic with separate amplifier which is automatically connected to audio input when there is no plugged in audio signal. This makes it wireless from audio source and much more mobile therefore. I could send the pictures and video to your mail address if you want to. You’ve made a very good initial design, this is just an improvement and it works very fine!

    As for remote IR – I was thinking about processor load and came to conclusion that it is still might be possible to implement I believe. It could be just one additional check on the IR signal presence in the main loop which will not consume a lot of resource, the smallest size simple IR lib is still needed though. In case the received IR code matches the prescribed one (only pattern change is needed so far I think) just another small subroutine (void) should be there to select the pattern in a button push cycle – almost the same as in pattern button case. As soon as there is no IR signal checked the main loop should work as it is. This small check should not overload the main processor from real time FFT calculation. It could be easily checked I think. Hope that it might be interesting for you. Many thanks!

    #8695

    Michael Krumpus
    Keymaster

    Hi Vadpol, I’m glad you reported back with your progress. Sounds like you’ve been having a lot of fun with it, so that’s great. Feel free to send pictures if you want.
    Regarding the IR signal: you are correct that checking for the last received IR code could be done once every time through the loop(), but the problem is that the processor needs to measure the IR pin on a constant basis to pick up all the changes in the voltage. IR sensors modulate a 38KHz frequency, so the receiver has to read the sensor pin thousands of times per second. The IR library does this by scheduling an interrupt service routine (ISR) to run at this high frequency and keep track of the voltages. So, this code does need to run all the time as an ISR, and that would interrupt the Lumazoid code thousands of times every second. It would interfere with the collection of analog samples and probably ruin the audio analysis.

    Bottom line, even if you ask for the last code infrequently, the microcontroller has to make many perfectly timed measurements to receive the signal.

    Here is a good description of how it works: https://learn.sparkfun.com/tutorials/ir-communication

    Keep having fun with your project though — you are making lots of good improvements!

    #8697

    Michael Krumpus
    Keymaster

    Here is some more info about why reading an IR sensor and reading the audio at the same time is going to be a problem. The ISR code in an IR library will use a timer interrupt vector to run some code thousands of times per second:

    ISR(TIMER2_COMPA_vect){
    ...
    }

    This is the code that will run on a constant basis, interrupting the Lumazoid code. The TIMER2 interrupt vector has higher priority than the ADC (analog to digital conversion) interrupt, so it will preempt the ADC conversion. See the Lumazoid code ISR:

    ISR(ADC_vect) {
    ...
    }

    This is the code that runs 9000 times per second to sample the analog input. It must run with precise timing between samples or the frequency analysis will be wrong.
    But try it and see what happens!

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

You must be logged in to reply to this topic.