Generating 38khz output signal from Micro Maestro

I understand that it should be possible (in theory) to generate a 38khz signal output from the Maestro units. I want to use this to light up a IR LED that signals to two “Vishay TSSP58038 IR Detectors”, as a means of registering activity in a hallway.

Does anyone have any info, or directions to where to look for what I want?


It might be possible to modulate an IR LED at 38kHz, but you will likely need to power the LED through a MOSFET and it would probably be the only thing the Maestro script could handle. Instead, you might consider using something like our 38 kHz IR Proximity Sensor, Fixed Gain, High Brightness sensors. The boards have an emitter and detector, but you could just ignore the output signal and use them to emit the modulated IR light to your Vishay sensor. This would also allow you to turn the LED on and off with the Maestro using the enable pin on the sensor board. However, I am not sure how well this might work for your project as it has limited range. You might need to do some testing to see how well it works. Alternatively, you might consider something like a PIR Motion Sensor if you are trying to detect something like people moving through a hallway.


Thank you. Used the prox. sensor as suggested, and it worked well with minimal noise at 70cm range.

I apologize if this it the wrong place to ask, but since it is the same project, I try. Feel free to direct my question somewhere else… I can not figure out where I did wrong on this code for the sensor. My Control center puts out the error message “Error applying parameters. Stack empty” when I try to apply my code… I dont understand why the stack is empty in this case:

4 get_position      #Get first IR-Sensor position
500 less_than       #Is IR-Sensor activated
   if               #If it is
   5 get_position   #Get secondary IR-position
   500 greater_than #IF this IR is not YET active, go to
      Wait_for_5    #Waiting for secondary IR-activation sub-routine
   endif            #IF 2 IR is already active, go to start

SUB Wait_for_5
   50                #timer for loop
   dup               #copy counter before while
   while             #Jump to return if stack-number is ZERO
      5 get_position
      500 less_than  #IR-sensor active?
      Alarm          #Alarm activation sub-routine
   1 delay           #delay for 1 ms
   1 minus           #take away 1 from loop-number

SUB Alarm
   led_on         #Internal LED on
   700 delay      #Delay
   led_off        #Internal LED off
   300 delay
   700 delay
   300 delay
   700 delay

…Thank you

I am glad the proximity sensor is working for you. I looked over your script briefly and noticed a couple of problems. The first is that it looks like you might be missing an if command and an endif command inside of your while loop. Right now, it looks like your code reads channel 5 and sees if it is less than 500, but does not do anything with the result. I suspect the error you are seeing is coming from the structure of your while loop. It should go away if you put begin just before dup and repeat just before RETURN in your wait_for_5 subroutine. For example, your wait_for_5 subroutine might look something like this:

sub Wait_for_5
    begin		#begin/repeat loop for the while starts here
            5 get_position
            500 less_than  
            if	            	#only run the Alarm subroutine if channel 5 is less than 500
        1 delay          
        1 minus          
    repeat     	 #tell the while loop when to repeat


Thank you. That put me on the right track again.

  • Am I right in concluding that the maestro 6 can not deliver a higher PWN than 1000hz? Was hoping to be able to put out closer to 3000hz for a electromagnetic buzzer resonant frequency, but I might have needed the maestro 12 to do that (as far as I have been able to read up on).

Thanks again for great service and support! -Magnus


The Micro Maestro supports standard RC servo signals and does not support sending arbitrary PWM signals. But, like you have already started to suspect, using a Mini Maestro (whether 12, 18, 24-channel) would work fine for 3kHz PWM.