Raspi BirdBox Advice

I’ve had another idea. All the documentation for the Constant Current module refers to a string of LEDS. Some of the Adafruit documentation says that it is not suitable for a single LED. The device might work better at a higher output voltage.

Power the module from 3.3V, not 5V. String your three LEDs together positive to negative but leave the current setting for the module at 25mA. Connect the positive end of the string of LEDs to the module LED+ and the negative end to the module LED- and check again. Test the voltage at the module output. It should now be ~3.6V. If that still doesn’t work we can force the voltage even higher by adding a resistor to the LED string.

1 Like

As a sanity check check the voltage on GPIO18
i.e. in code
turn it on, measure voltage at pin.

Its my goto when things dont work… is the pin doing what I expect :slight_smile:

2 Likes

Thanks, I’ve read similar regarding the use a single vs multiple LEDs. I’ll definately give that a go.

I really appreciate all your help on this one…

Thanks Michael.

I know my code works using the same GPIO as I am using to connect to the controller’s PWM pin, as I’ve tested it with a simple circuit and a standard LED.

But at this point its probably worthwhile testing the voltage.

Thanks

Hi All
I haven’t had anything to do with these particular settable constant current sources. but I have used various fixed constant current circuits in the past. You are just inserting a variable resistance into the supply path. The applied voltage is usually what is required worst case and the “resistance” varies to suit load changes. Mostly a transistor with a reference voltage at the base and a sensing resistor in the emitter. PNP or NPN depending on circumstances. Even a very large resistor can be used in the right situation. I once worked on Rediffusion CCTV (analog) Vidicon cameras which required 0.03µA which was a 10V supply and a 3GΩ resistor.

My query is is a constant current source PWM controllable. I have not tried this personally. Maybe these are but how I just can’t picture in my mind.
Cheers Bob

2 Likes

Thanks again everyone for all the advice.

So, I did some testing and had some success. Using Jeff suggestion, I tested the Constant Current module connected to the Pi as I’ve mentioned previously, and 3 standard LEDs connected to it (in series as the documentation suggests.

I was then able to drive the controller in PWM mode using the Raspberry Pi equivalent of the code suggested by Jeff, and in this way I found I could turn the LEDs on and off. For reference the LEDs were lit as soon as power was connected to the controller (in my case 3V).

I’ve managed to misplace my spare IR LEDs so didn’t manage to test with those. Is it likely I’ll need 3 of these guys as well, or will two do the job do you think???

1 Like

That’s great progress - we now know what the issue is.

Apparently the module does not respond to the PWM (CTRL) input if it is in ‘pass-thru’ mode - that is, if the voltage at the input is less than a certain value based on the output voltage. This value is not mentioned anywhere that I can see, but is probably the output voltage (as calculated according to the maximum current setting) plus 1 or 2V. In this mode the module is not boosting the voltage but simply passing it through as supplied. I can’t find any reference that mentions the PWM input becoming inoperative under this condition, so perhaps the documentation simply assumes that the device is never operated like this so it’s not worth mentioning.

Linking three LEDs together in order to boost the calculated output voltage is one way of getting the PWM input to work.

Another option would be to increase the current to (say) 50mA with one or two LEDs. That would require the module to boost the output voltage to maintain the required current setting, and that would enable the PWM input. But note the comments above about optimum current settings for the LEDs you have - if the current were boosted to 50mA then I think it would only be safe to drive the LEDs in PWM mode with a reduced duty cycle.

A third option is to simply insert some resistors in series with the single led, and leave the current setting at 25mA. The resistors will look like additional LEDs so you will have the ‘string’ the device seems to require. If you have available resistors you could start with about 1K and work down.

A fourth option is to create a string of ordinary LEDS together with your IR LED.

Please refer to the device datasheet:
:

6.4.1 Operation With CTRL
The enable rising edge threshold voltage is 1.2V. When the CTRL pin is held below that voltage the device is disabled and switching is inhibited. The the[sic] device’s quiescent current is reduced in this state. When input voltage is above the UVLO threshold, and the CTRL pin voltage is increased above the rising edge threshold, the device becomes active. Switching enables, and the soft-start sequence initiates

6.3.5 LED Brightness Dimming (1) The TPS61169 receives PWM dimming signal at CTRL pin to control the total output current. When the CTRL pin is constantly high, the FB voltage is regulated to 204mV typically. When the duty cycle of the input PWM signal is low, the regulation voltage at FB pin is reduced, and the total output current is reduced; therefore, it achieves LED brightness dimming.

So the CTRL can be either a switch or a PWM.

The chip has a pull down of 300K, but the module has a pullup of 30K. So the default mode of operation is on; switching the PWM low will turn it off.

1 Like

Hi Jeff.
Thanks for that.
My query was because I have never had the need to “DIM” or otherwise adjust a constant current supply while operating. Any adjustment to the required current has always been of a permanent or semi permanent nature and usually done by changing the sense resistor or reference if more convenient.
Cheers Bob

1 Like

Thanks again everyone. Its certainly been a bit of a learning experience.

Anyway I found I was able to switch the LEDS on and off using the pwm function of the current convertor when I had 3 connected in series. 1 or 2 didn’t appear to work, even when increased the voltage via the dip switches.

I also found that add some resisters to my circuit worked, with a single LED in play. I didn’t have any 1k resisters on hand so I used 2 x 520’s in series.

Its also worth noting that I picked up some new IR LEDS, which admittedly are a bit different that the ones I had originally (and that I now can’t find). The ones Im using now are these ones - 5mm Infrared Transmitting LED | Jaycar Australia - sorry for buying from a competitor but I was passing by…

I did notice that they have a forward current listed at 50mA which is different to the original ones I had which were listed at 100.

At this point though, I’m wondering if we even need the current convertor. If I’m running at 25mA as opposed to 15ish off one of the Pi’s GPIO pins am I really going to notice much difference?

2 Likes

Congratulations. It certainly can be a bumpy trip at times!

Perhaps Core might want to put up a warning about the converter requiring a certain load before it starts working. The Adafruit notice might be the same warning, but it is very badly stated.

You are running at 25mA because the converter is controlling the supply at that current. You could run the LEDs at 15mA direct from a Pi GPIO, but you would need to somehow control the current to the 15mA that the GPIO allows (although that is running very close to the absolute maximum). There are ways to do this, including a simple resistor, but none is as good as the converter. The problem with the resistor is that when the supply voltage is very close to the required voltage that is needed to get the resistor and LED combination to draw 15mA there is increased risk of instability. You also need to consider that you might need more than one LED to get the images you want.

1 Like

Hi All
For what it is worth and for those interested here are a couple of simple constant current source circuits i have used very successfully in the past.

Very simple.
A reference voltage is provided for transistor base. This could be a Zener (shown), a few diodes, a dedicated reference or even a LED (as an indicator as well). It does not matter as long as it is stable.
RReference is calculated to suit reference device.
RSence is calculated for a voltage drop equal to VReference minus 0.6V at the required current.

This circuit is not terribly elegant but is very simple and is good for a quick and cheerful constant current source and what is important it works.

RSense should be kept as low as practical to reduce wattage dissipation requirements in the resistor.

For larger currents transistors like the 3055 or PNP equivalent can be used. For larger currents again a heatsink might be needed.
Cheers Bob

1 Like

Good idea, I think that page needs a more explicit notice about the load required to get working and possibly a rewrite. I’ll go ahead and update that.

Hi all, and apologies for not having been back here in a while. The family has managed to pick up the old corona virus, so I’ve had some time at home to get back into working on this little project.

I’ve managed to make some really good progress on the back of all the helpful advice I’ve gotten for you guys. At this point, I’ve got my infra-red camera setup together and all working. I decided to go with Jeff’s advice and use the current convertor along with 3 IR LED’s. The finished product isn’t as neat as I would liked in that it wouldn’t all fit in the case I bought but overall I’m pretty happy. Don’t judge the tape across the front - its covering a hole I originally drilled for a single LED

Besides it’ll be inside the birdbox, so appearances aren’t important.

What is important is that it all works. Using a utility called mediaMTX I was able to set things up so that when someone hits the URL for the stream, the camera and the IR LEDs are turned on, and the image is visible. When the browser is closed or the user navigates away from the stream the camera and the LEDs get turned off again.

My next challenge is to get this all running off a solar panel and battery. For this I have a 12v, 10w solar panel, one of the great little controllers (Solar Power Manager Module (D), Supports 6V~24V Solar Panel and Type-C Power Adapter, 5V/3A Regulated Output | Buy in Australia | WS-26363 | Core Electronics) and an old 10,000 mAh battery pack.

The first time I hooked it all up the LEDs on the controller seems to flash erratically and the charge light on the battery pack seemed to turn on and off randomly. It is however a very grey day, so it might be that there’s not enough voltage coming from the panel. I’ll try again on a sunnier day.

Also, I’m not sure if my battery pack I have is suitable for the controller as it only has a 5v - 1.5A input. I got a free battery holder (3 x 18650) with my Waveshare controller so I’m wondering if I might be better off getting 3 of these cells (Polymer Lithium Ion Battery (LiPo) 18650 Cell (3.7V 2600mAh, Solder Tab) | Buy in Australia | CE04625 | Core Electronics)> I realise its a bit less capacity but would this work better???

1 Like

I think I can answer my own questions here. Having hooked up my solar panel today (a bright, sunny day) I can see that its now showing a good level of voltage on the controller, at the panel input (anywhere from 6 - 22v). It’s also shows a constant voltage of between 3.5 and 4V at the battery terminals. Therefore, I can see that it’s not going to charge my old battery pack which has an input voltage of 5v.

So I think I’ll be purchasing some 18650 cells and utilising that bonus battery holder after all…

1 Like

Hey Shane,
Great project. As it happens I have an owlbox and am building a pi IR camera to watch the owls.
I’ve gone with a Pi zero W2 and the pi camera 3 NOIR. I’m powering it off a 90AH marine battery I had lying around and a jaycar 140W solar panel and an MPPT charge controller. It runs fine but I’d fogotten to wire in the IR LED…..
I was planning to simply use the +5V(GPIO Pin2) and GND(GPIO pin 6) pins with a single IR LED and an inline resistor.
I understand these pins can supply the neccessary 50mA current @ 1.5V….I’ve just ordered the IR LED from Core.
Robert/Geoff - will this work and what size resitor do I need inline with the COM-09349 (Core SKU)

1 Like

Hi prhewett

I would assume here that the 1.5V is the forward voltage across the LED.

If that is the case there are tutorials which describe how to calculate the current limiting resistor. Ir would not do any harm to learn

In a nutshell it is simply this
(supply Volts) 5V (From GPIO Pin2) minus (LED voltage drop) 1.5V (= 3.5) divided by (required current) 0.05A (50mA) equals (resistance ohms) = 70Ω.

The resistor wattage required is I^2 * R or 0.05^2 * 70 = 0.175W or 0.5W to be on the safe side. The nearest preferred values are 68Ω and 75Ω. I would use 75Ω and put up with a bit less current to be on the safe side of things.

Please check that 50mA pin capability. Also keep in mind the processor will have a TOTAL figure for the GPIO pins and it will be a lot less that 50mA times the number of pins. Over to you.
Cheers Bob

2 Likes

Thanks Robert. I guess I was asking if the 5V pins will supply that much current - Google results tend to be a little ambiguous about this from my research so far. I understand the normal GPIO pins are limited to 16mA . I had done the maths myself and came to a similar figure for the resistor.

1 Like

Hi prhewett
I don’t know much about RPi but I would think 50mA would stretch things a bit.
You might be better off using the 5V signal to drive a logic level N channel Mosfet as a low side switch..
Connect the Gate to GPIO via about a 1kΩ resistor.
Connect the Source to Ground (-V)
Connect the Diode Cathode to Drain via the limiting resistor
Connect the Diode Anode to 5V supply.
The resistor can be either side of the Diode but DON’T put it on the ground side of the Mosfet.
Stay with 5V. Don’t pussy foot around with 3.3V when you have 5V available or you are likely to have problems with Mosfet switching and 3.3V narrows the available field somewhat
Cheers Bob

2 Likes