Tiny PCB weighing 2.5 grams w/ a few features

2 channel constant current programmable output, IR communications, weight < 3 grams

Similar projects worth following
2 channel constant current programmable output, IR communications, weight < 3 grams, board size 1cm x 1cm

Exploring an idea for a neuroscience application.

Link to BOM.

brd - 65.88 kB - 10/14/2020 at 13:05


sch - 160.69 kB - 10/14/2020 at 13:05


Adobe Portable Document Format - 11.60 MB - 06/19/2020 at 15:54


Adobe Portable Document Format - 960.99 kB - 06/19/2020 at 15:54


Adobe Portable Document Format - 109.48 kB - 06/19/2020 at 15:54


View all 31 files

  • Schematic/ testing Pickit

    Sophi Kravitz06/06/2020 at 21:19 0 comments

  • Toggling a register bit helps

    Sophi Kravitz05/20/2020 at 01:33 1 comment

    The signals image in the last log shows an interrupt on every rising edge, and so whatever I thought I coded wasn't it. 

    This image is perfect. The pink signal on the top is the interrupt being triggered every time the IR receiver gets a hit. It's inverse, but it's not a big deal.

    Now I need to count the time in between the pulses.

  • NEC decoding in C

    Sophi Kravitz05/17/2020 at 15:57 6 comments

    I've been working on NEC decoding for a few weekends now, and I'm starting to understand it, although coding in C is tricky for me.

    The basic premise is that an interrupt on rising/ falling edge change starts a timer and this is checked against the NEC condition.

    I'm using this page by Simple Projects as a guide.

    The message of the NEC protocol is 32-bit long, address (16 bits), command (8 bits), and inverted command (8 bits). Before the 32 bits there is 9ms burst and 4.5ms space.
    A logic 1 is represented by 562.5µs burst and 562.5µs space (total of 1125µs) and a logic 0 is represented by 562.5µs burst and 1687.5µs space (total of 2250µs).

    In my PIC16LF1708, I've got the external interrupt connected to pin A2 (input from IR receiver) on falling edge working with Timer0. 


    • Make the external interrupt on A2 interrupt on change.
    • Figure out what the numbers in the TMR0 register equate to, and if a different timer is needed.

    TMR0 is 8 bits, so counts to 256 in 65ms (using INTOSC, 4MHz). Since the total length of a 1,2,3,4,5, or 6 on the NEC remote I have is about 56ms, it's fine for the moment. Might move to Timer1 later.

    I'm having a lot of trouble getting the IOC (interrupt on change) to work. I've tried a few examples and they're simple enough, but the IOC happens intermittently. I'm thinking about soldering a debounce circuit onto my Curiosity board to filter out garbage signals. 

    In the image below, the top signal is the interrupt, the bottom signal is pressing the "2" key on the remote control. I don't think it's a good enough match to decode. 

  • MPLab X + Interrupts + Timers (decoding NEC)

    Sophi Kravitz04/26/2020 at 17:42 0 comments

    Today's goal is to measure the time between external interrupts.

    External INT on a PIC16LF1708 is on RA2. Use the internal weak pull-up.

    It's not that easy to find where to set, so I'll put it here. Use MCC's Pin Module to enable the register. In order to set individual pull-ups (rather than a whole port at once), the WPUEN bit must be enabled.


    • Go to ISR
    • Set Timer0 to 0
    • Count until next EXT interrupt // here I am using a wire on A2
    • Timer0 = elapsedTime
    • elapsedTime - 0 = time
    • Timer0 = 0

  • IR receiver and communications

    Sophi Kravitz04/12/2020 at 15:54 0 comments

    To do: work out IR receiver circuit to adjust current and pulse output.

    I used this guide and the TSOP62 datasheet to come up with a simple test circuit.

    The input comes from a transmitter.

  • DAC/ op Amp config

    Sophi Kravitz03/29/2020 at 21:37 0 comments

    Today's tasks:

    1. Configure DAC: make sawtooth wave
    2. Configure op Amp as c2v converter
    3. Choose GPIO and output 100 Hz and 158 Hz square waves
    4. Start designing IR receiver circuit

    Configuring the DAC wasn't hard, but with the Curiosity board there's a gotcha. Pin RA0 (DAC1 output) has some kind of load (edit: an LED is attached) on it. The DAC is simply ramping up/down using the DAC1CON1 register. With several tries I only reached 2.0 volts at peak (you can see in column B). 

    Eventually I pulled just that pin out of the socket and this is the nice signal, exactly as expected.

  • Integrated op-amp and DAC config

    Sophi Kravitz03/22/2020 at 22:05 0 comments

    I started the work sesh with these main tasks:

    1. Configure both the DAC and the op-amp in MPLAB. This checks out, there is 1.005V on pin 17 (DACOUT2)

    2. Configure the Curiosity board to measure current. I added a 22k resistor across pins 13 to GND, and a red LED between pins 13 and 14. POT1 on the curiosity board ramps the DAC input up and down.

    3. Write firmware to ramp the DAC input up and down.

    I'm not sure if/ how to do an input to the DAC internally (right now I'm using an external pot). I'm also unsure if it's even possible to have multiple digital levels. 

    I *think* so as it says in the data sheet: The DAC has 256 voltage level ranges. The 256 levels are set with the DAC1R<7:0> bits of the DAC1CON1 register.

  • Testing the on-chip integrated opAmp

    Sophi Kravitz03/01/2020 at 23:16 0 comments

    The PICLF1703 (and 1717 etc.) have integrated OpAmps. 

    I'm configuring one of them as a voltage to current converter (transconductance amplifier) using Microchip's graphical MPLAB X IDE w Code Configurator. It looks like this:

    Note: A device reset forces all registers to their reset state. This disables the OPA module.

    Ok excuse this crappy sketch, it's a placeholder so I don't forget where I was. I wired this up. R1 = 100 ohm and R2 is 22k. Nothing happened when I downloaded the config into the chip, will troubleshoot soon.

  • SPECS + getting started

    Sophi Kravitz02/21/2020 at 19:02 0 comments

    The specs of this project are:

    • 1 input channel: IR 38kHz receiver
    • 2 output channels
    •  2 different frequency pulses in the 130 Hz range
    • Programmable constant current on output in 30 - 250 uA range
    • LED to show pulsing (2 different patterns or colors)
    • LED to show power on
    • IR transmitter (off-the-shelf) compatible with 38kHz receiver
    • Coin cell battery CR1025 (10 mm dia)
    • Desired weight < 2.5 grams
    • Desired area footprint 1 cm x 1 cm

    I'm prototyping with one of Microchip's Curiosity dev board, which comes with a 20 pin DIP PIC16F1619.

    I've gotten to blinky with MP Lab X and the code configurator, the documentation isn't that great, but maybe just because there's a lot of it. Getting to blinky took 2 hours.

    I swapped the 20 pin DIP out for a 14 pin DIP PIC16LF1703. This chip has 2 on-chip opAmps. I need a constant current supply for the circuit I'm designing, and so thought it might work with one of the on-chip opAmps. 


View all 9 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

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