DAC GPIO25 GPIO26 as SPO2 LED power driver - problems

eldadwasserman
Posts: 8
Joined: Tue Oct 31, 2017 7:44 am

DAC GPIO25 GPIO26 as SPO2 LED power driver - problems

Postby eldadwasserman » Sun Nov 26, 2017 7:33 pm

Hi,

Maybe someone here can hep me.
I am trying to use the DAC GPIO25 and DAC GPIO26 for sending switch power to nellcor SPO2 LED.
The LED has 2 wires only. I need to send 0 / 3.3V and 3.3V / 0 every 250nsec. this way the LED transmit RED / IR light every 250usec.
When I am using regular GPIOs (lets say GPIO16 and GPIO17) and I am sending power with this command:

while (true){
gpio_set_level(16, 0);
gpio_set_level(17, 255);
delay(250usec)
gpio_set_level(17, 0);
gpio_set_level(16, 255);
delay(250usec)
}
the above code works fine and the LED is working excellent (RED..IR..RED..IR..RED....)

When I use the commands:
while (true){
dac_output_voltage(DAC_CHANNEL_1, 255);
dac_output_voltage(DAC_CHANNEL_2, 0);
delay(250usec)
dac_output_voltage(DAC_CHANNEL_1, 0);
dac_output_voltage(DAC_CHANNEL_2, 255);
delay(250usec)
}
This code is not working. only if I am connecting one of the LED pins to the GND - i am getting full power to the LED. but I must connect the 2 LED pins to "power output" for switching 0/255/255/0/0/255 etc...

Is anyone here know what is the solution for this situation ? i.e. a 3.3V current need to flow from one LED leg to the other leg and vice versa.


It will be great if I can get help...

Thanks

Eldad

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: DAC GPIO25 GPIO26 as SPO2 LED power driver - problems

Postby WiFive » Sun Nov 26, 2017 10:34 pm

Why are you trying to use dac instead of gpio_set_level(25, 0)?

You should use a hardware peripheral like rmt or pwm to do this, not code

Who is online

Users browsing this forum: Google [Bot] and 186 guests