This was in the mail two days ago:
There were a second sticker and a third board but I just wanted to show top and bottom here.
The board cuts aren't really clean:
The result after soldering (the Aisler stencil did a good job!) and adding a teensy:

In that circuit, I just use the teensy to
- supply power to the power button board
- measure the sense output (pin D0 with an internal pullup)
- measure the output voltage (pin D1)
- control the keep_alive pin (pin D2)
Here's the sketch, which
- prints some state output on Serial
- when the button is pressed, keeps the output alive for seconds
#define SENSE_PIN 0 #define POWER_PIN 1 #define KEEP_ALIVE_PIN 2 void setup() { pinMode(SENSE_PIN, INPUT_PULLUP); pinMode(POWER_PIN, INPUT_PULLDOWN); pinMode(KEEP_ALIVE_PIN, OUTPUT); digitalWrite(KEEP_ALIVE_PIN, 0); } void loop() { static const uint16_t on_time = 2000; static elapsedMillis on_timer; static bool on = false; static const uint16_t print_time = 250; static elapsedMillis print_timer = print_time; if(!digitalRead(SENSE_PIN)) { on_timer = 0; on = true; digitalWrite(KEEP_ALIVE_PIN, 1); } else if(on && (on_timer == on_time)) { digitalWrite(KEEP_ALIVE_PIN, 0); on = false; } if(print_timer >= print_time) { Serial.printf("sense: %01d | power: %01d | on: %01d\n", digitalRead(SENSE_PIN), digitalRead(POWER_PIN), on); print_timer = 0; } }
This worked as expected.
I also tried to modify the circuit to make it latch by itself. It just needed a strong enough pullup resistor (I had 2k7 at hand) from Q2's base to Vbat_out and once the button was pressed, power stayed on by itself.
Next: Test with a Teensy that can shut itself off with this circuit, because that's waht I had in mind when I started this project.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Thanks for the pics of the Aisler boards. I wanted to try them with one of my next boards as they are located in Germany but I am really concerned with that outer routing! Having traces like 1mm from the outline seems risky here. Which is no problem with OSHPark for example. Even the dirtyPCB board I ordered looked better...
Are you sure? yes | no