Skip to content

Connecting the ATTiny_Daemon Hardware

jbaumann edited this page Jan 19, 2020 · 3 revisions

Connecting the ATTiny_Daemon

The first step in connecting the ATTiny_Daemon hardware is to plug it into the Raspberry Pi. Here is a picture of the small v1.7 version and the v1.8 shim version installed on the RPi. The v1.8 Shim has an additional hole that allows to screw it down to the UPS using a spacer (as can be seen in the photo).

On this picture you can also see the normal connections needed, the red cable being the battery connection powering the ATTiny_Daemon and the orange one being the switch connection that allows the ATTiny_Daemon to switch off the whole system and to reboot the RPi.

Connections

Pinout

If we look at the PCB we can see that there are a number of pins on the header (see the right side in the following picture).

These pins and their functionality are as follows:

Pin Function Use
1 - Vcc Battery Connection (mandatory) Powers the ATTiny and has to be connected to the Li-Ion battery
2 - Rst Reset / Extension (optional) TOptional and currently allows to reset the ATTiny.
3 - Sw Switch Needed if you want to use the ability of the ATTiny_Daemon to restart the RPi. It connects to the on/off switch of the UPS
4 - Btn Button (optional Can be used to connect a button that, when pressed, allows for configurable actions (the button has to connect the pin to GND)
5 - Ve External Voltage (optional) Allows to connect an external voltage that is to be monitored e.g., the primary power
6 - GND GND (optional) Provides a connection to GND, e.g. for the button on pin 4

Necessary Connections

Pin 1, the connection to the battery is essential because this is how the ATTiny on the board is powered. At the same time, it is used to measure the battery voltage and thus get an understanding of the remaining charge in the battery. This connection has to be made from the beginning, otherwise the ATTiny_Daemon does not work at all.

Pin 3, the connection to the switch that turns the UPS off and on is important as soon as we do not only want to get information about the state of the UPS, the battery and the primary power, but to be able to turn off the UPS and to reset the RPi. You should plug this in when you are reasonably sure that the ATTiny_Daemon does what you want, i.e. after you have installed the hardware, the software and configured the whole system to your liking. If you want to experiment with cutoff voltages and other things, simply remove this connection to the UPS and connect the header to a voltage meter or better yet an oscilloscope.

Optional Connections

Pin 2, the RST pin, currently is of not much use. If an additional pin is needed we can use this pin by programming the ATTiny accordingly. This means that we lose the ability to reset the ATTiny though and thus the ability to simply reprogram it. For that we need a High-Voltage-programmer. While these are easy to build, this is an additional step when programming and is quite annoying. So, as long as we do not really need this pin, it will simply reset the ATTiny.

Pin 4, the Btn pin, allows you to connect a button that, when pressed, executes a configurable command in the attiny_daemon (see documentation). Connect the other pin of your button to pin 6, GND.

Pin 5, Ve, allows to connect an additional voltage that is measured by the RPi. This voltage is routed over the pin header P3 using a jumper (the other position connects to the RPi power using the diode to protect the RPi). This can be an arbitrary voltage that you want to monitor, but can be used to monitor the primary voltage of your system as well. In case of the Geekworm UPS1 this is not feasible though, because the UPS1 provides 5V on the primary voltage input as soon as it is disconnected from primary power (the UPS2 is much better in this regard).

Pin 6, GND, provides a simple way to access GND e.g., for the button you connect to Pin 4.