Close
0%
0%

Greenhouse Blinky

A small low-power blinky using BPW34 photodiodes as solar cells

Similar projects worth following
This project uses eight BPW34 photodiodes to run a MSP430F2012 microcontroller that blinks all day and all night, thanks to a large capacitor.

"Greenhouse Blinky" is a blinky that gets charged even in dim light using BPW34 photodiodes, and runs a MSP430F2012 microcontroller from a large capacitor.


Schematic in ASCII art:

   Eight BPW34 photodiodes in series
  A C  A C  A C  A C  A C  A C  A C  A C
/-|>|--|>|--|>|--|>|--|>|--|>|--|>|--|>|-\
|                                        |
|                                    + - |
|      BAT85 Schottky Diode          | | |    1.5F 3.6V
o---------|>]----------------------o-| |-o   Memory backup capacitor
|        A   C                     | | | |   (low self-discharge)
|                                  |     |
|                            Anode o-|>|-o Cathode  Blue LED as shunt regulator
|                                  |     |
|                                 [o o o o]  Four pin programming header
|                                  | | | |
|                            Vcc   1 | | 14  Vss
|                            P1.0  2 | | 13  P2.6
|                            P1.1  3 | | 12  P2.7
|                            P1.2  4 | \-11  TEST
\----------------------------P1.3  5 \---10  /RST--[15kOhm]-->Vcc  Reset pullup
   Red LED Anode     /-------P1.4  6      9  P1.7
   Red LED Cathode   \--|>|--P1.5  7      8  P1.6
                                 MSP430F2012

Eight BPW34 photodiodes in series provide the voltage even in dim light to charge the memory backup capacitor, which was selected because of its low self-discharge current. The generated voltage is fed directly to pin P1.3 of the MSP430F2012 which is set as input, and due to internal protection diodes on the GPIO pins the microcontroller can charge the capacitor. For improved low light performance and to reduce current through the protection diode on very high light levels, a BAT85 schottky diode was added which bypasses the internal protection diode of the input pin with its lower forward voltage.

The firmware is written in Forth, and can be cross-compiled using current Mecrisp-Across:

new

\ <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
    TARGET
\ <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

\ ----------------------------------------------------------------------------
\  Timer interrupt handler flashes LED
\ ----------------------------------------------------------------------------

: impulse ( -- )
  16 p1out cbis!
  16 p1out cbic!
;

\ ----------------------------------------------------------------------------
\  Hello World
\ ----------------------------------------------------------------------------

: blinky ( -- )

  \ Pin & Clock initialisation

  \ Disable crystal oscillator, set P2.6 and P2.7 as low outputs
  0 p2sel c! 0 p2out c! %11000000 p2dir c!

  \ No special functions, set P1.3 input, all others low outputs
  0 p1sel c! 0 p1out c! %11110111 p1dir c!

          0 DCOCTL  c!
          0 BCSCTL1 c!
  %00001000 BCSCTL2 c!  \ SELS: VLO --> SMCLK
  %00100000 BCSCTL3 c!   \ LFXT1S VLO, 12 kHz --> SMCLK, ACLK

  \ Timer initialisation

   $10  TACCTL0 !  \ CCIE
 12000  TACCR0  !   \ VLO/12 / 1000 = 12 kHz / 12 / 1000 = 1 Hz
  $110  TACTL   !    \ ACLK, Up Mode

  begin
    lpm3
  again
;

\ <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
    HOST
\ <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

$FFF2 vector impulse \ Timer A0
$FFFE vector blinky   \ Reset vector

crosscompile

disimage-file helloworld.asm
 hexdump-file helloworld.hex

bye

Pins are configured, with all unused pins set to low outputs in order to avoid floating inputs.

P1.3 is left as input, to accept charge, and could be used to measure the voltage generated by the photodiodes at the moment. The internal analog-digital converter could be used to compare the capacitor voltage (the ADC internally allows a Vcc/2 measurement relative to internal 2.5V or 1.5V bandgap references) and the photodiode chain voltage relative to VCC to determine if the capacitor is currently charging or not. Also there is a temperature sensor available to be read with the ADC in the MSP430F2012.

The red LED is connected with both anode and cathode to the microcontroller, as this allows for brightness measurements  (see LEDs as photodiodes and Which colours are LEDs sensitive to ? for details).

These advanced features are not yet in use in this simple blinky "Hello World", the code instead serves as a testbed of the lowpower configuration of the microcontroller:

An internal ~12 kHz oscillator (VLO,...

Read more »

2023_03_25-a-Greenhouse-Blinky.zip

Kicad and Gerber files

Zip Archive - 1.11 MB - 04/29/2023 at 20:57

Download

helloworld.asm

Disassembler listing

asm - 1.06 kB - 03/17/2023 at 21:00

Download

helloworld.hex

Hex file of the compiled firmware

x-hex - 364.00 bytes - 03/17/2023 at 21:00

Download

helloworld.txt

Forth source code

plain - 1.49 kB - 03/17/2023 at 21:00

Download

  • PCBWay Sponsorship

    Matthias Koch04/29/2023 at 21:10 0 comments

    For a long time, I wanted to dive into PCB design - and after releasing this project, Liam from PCBWay contacted me and kindly offered my first PCB production run for free! Many thanks!


    I immediately started learning Kicad, and as I admired the beautiful creations of the badge scene for a long time - being FPGA firmware developer in the MCH2022 badge team myself - I decided that I'll use the known good schematic, but try my very best in terms of artwork.


    I decided to go with blue solder mask, white silkscreen, ENIG gold finish, and of course I included artwork from XKCD: "Garden", https://xkcd.com/1663/ slightly modified and vectorised with Inkscape.

    Kicad allows direct SVG import into any layer - and the online Gerber viewer of PCBWay helped to get everything looking nice on the first try:


    As the new PCBs have the same schematic as the original, flashing the unmodified hex file was enough for the solar blinky to start working.

    While doing my first design, I also included a small Hilbert fractal as capacitive touch button in a charge pump configuration, and a PCB coil in order to hopefully allow wireless charging in darkness using a LC resonant circuit.

    By clipping on 4.7 nF and the oscilloscope and wrapping the PCB with two turns of wire to the function generator, I measured a resonance maximum at 957 kHz, with the frequency shifting to 310 kHz using a 470 nF capacitor, giving an inductance of 5.6 - 5.8 uH.

    Looking forward to more experiments!

View project log

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates