JOY-IT RASP STROM PI 3 User guide

StromPi 3
3
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 2
TABLE OF CONTENTS
1. Introduction
2. Overview
3. Current sources
4. Functions of the StromPi 3
4.1 Prioritization of input
4.2 Time-controlled applications
4.2.1 Real time clock
4.2.2 Automatic configuration of time
4.2.3 ShutDown timer
4.2.4 Alarm mode
4.2.5 PowerOff alarm
4.2.6 WakeUp alarm
4.2.7 Minute Wakeup Alarm
4.2.8 Interval function
5. Additional functions
5.1 Serialless mode
5.2 Example of usage with real-time clock
5.3 PowerOn button
5.4 PowerOff mode
5.5 Powersave mode
6 Configuration of StromPi 3
6.1 Activation of serial communication
6.2 Execution of the GUI script
6.3 VNC for remote desktop connection
6.4 SSH-Connection with PuTTy and Xming
6.5 SSH-Connection with MobaXterm
7. StromPi 3 scripts
7.1 Serial scripts
7.2 Serialless scripts
7.3 Raspberry Pi Pin-Layout
7.4 Automatic execution of scripts
8. Modifications
9. Opening of the serial console of the Strompi 3
10. console commands
11. Support
12. EU-Declaration of conformity
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 3
Dear costumer,
Thank you for buying our product. The structure and funcons of the StromPi3 are explained in the following chapters. We show you which sengs must be adjusted that the Raspberry Pi will work with
the StromPi perfectly.
If you get any dicules with the usage with the device, do not hesitate to conact us.
The StromPi3 enables the Raspberry Pi® and other single-board computer new areas of applicaon. Addionally ,the StromPi 3 has next to the same voltage inputs (mUSB, WideRange 6-61V) as the StromPi2 an oponal plug-in unit for baeries. This expands the Raspberry with a LiFePO4 baery which is a rechargeable emergency power source. Unexpected power failures are now in the past.
The priorized inputs can easily be changed which means the StromPi 3 is able to t in your project perfectly. With the voltage range from 6V to 61V and a current with up to 3A, there is enough power for bigger projects. In addion the StromPi 3 has an own congurable autonomously acng microsystem unit which can be used for a programmable start-stop behaviour:
Let your system boot and shutdown at dictated mes to do meassurements or to switch devices on and o (ideal for digital signals or for controlling machines). The included real me clock can be used to synchronize the me with the Raspberry Pi without internet access. There is also an expansion to control the serial interface (state baery charge, voltage of the in-/ outputs, control and conguraon) this
makes the StromPi3 to an absolute allrounder.
The StromPi 3 suits every applicaon area you choose perfectly.
1. INTRODUCTION
This Manual is made for the firmware version 1.71. We recommend upgrading the firmware of the StromPi regularly. You can download the newest version here. There is also a manual to flash the firmware in the download register.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 4
The StromPi 3 can heat up if it is under heavy load. Do not touch the board when it is in operation you could burn yourself. Pay attention that the device has a good air flow to prevent any damage from overheating.
2. OVERVIEW
high-power USB output
data / voltage output
microUSB voltage input
connceon LiFePO4 baery
GPIO port
Switch capacitor-buering
Wide-Range voltage input
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 5
The StromPi 3 can get its power from three different current sources. In case of a power failure it switches steplessly to the current source which is configurated as the second and after that to the third.
MICRO USB
The StromPi 3 can obviously, as usual, be powered via the microUSB port.
WIDE-RANGE
The Wide mode can be used with a current source from 6V - 61V. Connect the marked port to an arbitrary current source, as power supply or a vehicle electrical system.
Attention! The current source must be switched on within the range of 6 - 61 V. Please pay attention to the polarity to avoid damaging the Raspberry Pi or StromPi3.
3. CURRENT SOURCES
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 6
BATTERY-UNIT
The StromPi 3 can be expanded with an optional 1000mAh LiFe04 battery, which is a rechargeable emergency power source. You only have to plug in the separate available battery unit, which then can be configurated as the second or third current source. Because of the implemented GPIO-bar, you do not have any restrictions with the usage of the battery unit.
The StromPi 3 has a huge amount of configuration possibilities. You can configurate this device after your desires like for example the prioritization of input, optional shutting down as well as the WakeUp and PowerOff mode. More functions can be setup with our graphical user interface script.
To use all of the functions that the StromPi provides you have to use our Phython scripts.
These are listed and explained in chapter 7 StromPi 3 scripts“.
4. FUNCTIONS OF THE STROMPI 3
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 7
1: Choose StromPi mode.
2: Activate or deactivate the powerfail warning
3: Setup of the BatteryShutdown mode 4: Activate or deactivate the Serialless mode 5: Activate or deactivate the Power Save mode 6: Activate or deactivate the Poweroff mode 7: Setup of the Alarm mode 8: Setup of the Wakeup alarms 9: Setup of the PowerOff alarms 10: Setup of the Interval alarms 11: Setup of the real time clock 12: Activate or deactivate the Shutdown timers and setup the time (in seconds)
13: Activate or deactivate the PowerOn buttons and setup the time (in seconds)
4. FUNKTIONEN DES STROMPI 3
To use all the settings which are described in the following chapters you have to use the serial conncetion. In chapter 6 is an explanation how to configurate a serial interface for the Raspberry Pi.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 8
4. FUNCTIONS OF STROMPI 3
StromPi mode: The StromPi mode determines the prioritization of the separate current sources.
Powerfail warning: The PowerFail warning will show when the primary power source is failing.
Battery shutdown mode: The battery shutdown mode determines with which remaining battery level of the RaspberryPi the device will shut down.
Serialless mode:
The serialless mode allows a further usage of the serial ports by communication on a GPIO pin. [modifictaion required! Look at chapter 8 Modifications“]
Power save mode: The power save mode will reduce the power consumption if Wide is set up as the secondary power source. However, this is only recommended when the device is in operation with a low amperage (<2,5A / for example an Raspberry Pi without periphery).
Real time clock settings: In the RTC settings you can setup the time and the date of the real time clock manually or automatically with comparing and synchronizing the time with the Raspberry Pi.
Shutdown timer: If you have activated the shutdown mode and the StromPi detects a power failure at the primary power source the StromPi3 will send a signal to the raspberry through the serial interface to start the shutdown. After that the counter starts that will disconnect the powersupply to the raspberry.
PowerOn button: With the PowerOnButton you can start the RaspberryPi if it is in the poweroff state through short ­circuiting the two reset pins. [modification needed! See chapter 8 modifications“]
Interval timer: The interval timer can be setup to shutdown or boot the system after a selected time.
Alarm mode: The alarm mode refers to the WakeUp and PowerOff alarm. It selects if the alarm goes of daily, weekly or only at a specific date.
WakeUp alarm: The WakeUp alarms start the Raspberry Pi at a specific time.
PowerOff alarm: The PowerOff alarms shut the Raspberry Pi down at a specific time.
Poweroff mode:
The Poweroff mode requires the activation of the RaspberryPi with the PowerOn button after a
shutdown through the Shutdown timer. Additionally, this mode prevents the detection of a reversion of the primary power supply.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 9
The power source where the StromPi draws its power from can be set up as desired. In addition, you can select a second and a third power source which will take over if the first source fails. In the default settings microUSB is the primary power source and Wide is the secondary.
In total there are six different modes possible. The primary power source is the main power
source. The secondary power source will take over when the primary source fails.
The corresponding mode can be setup with the configcscript in choose StromPi V3 Powerpath Mode“.
MODE PRIMARY SECONDARY TERTIARY
Mode 1 microUSB Wide-Range ­Mode 2 Wide-Range microUSB ­Mode 3 microUSB Battery ­Mode 4 Wide-Range Battery -
Mode 5 (V1.6 or higher) microUSB Wide-Range Battery
Mode 6 (V1.6 or higher) Wide-Range microUSB Battery
4.1 PRIORITIZATION OF INPUT
Primary power source
failure
Prim. Source
acve
Sec. Source
ready
Prim. Source
failed
Sec. Source
acve
Automac change of power sources
due to primary source failure
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 10
4.2.1 REAL TIME CLOCK
The real time clock (RTC) of the StromPi 3 can be setup with the Configscript:
ADJUST TIME AND DATE MANUALLY
To adjust time and date manually click on Manual Setting. Now you can fill the fields in the right. If you click on Update it will set your setting.
SYNCHRONIZING TIME AND DATE WITH RASPBERRY PI
To synchronize time and date with the Raspberry click on Sync with Raspberry Pi. With the click on Update the time from the RTC of the StromPi will be compared to the time on the Raspberry. The newer time will be overwritten with the current one. The default time of the StromPi is the 01.May 2018 and the Raspberry Pi updates its time automatically if it is connected to the internet.
4.2 TIME-CONTROLLED APPLICATIONS
The StromPi 3 has a additional real time clock. If the power fails, the time-controlled applications are not endangered. Even time ­controlled shutdowns and boots are still possible! Please note that you have to use atleast one power source connected (mUSB, Wide or battery) - If all sources are seperated, the current time will not be saved.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 11
4.2.2 AUTOMATIC CONFIGURATION OF TIME
In addition we provide a script which synchronizes the time after the boot of the Raspberry. This script can be downloaded here in the download area in section Scripts“. Download the archive, unzip and copy the script to your Raspberry Pi. In chapter 7.4 Automatic execution of scriptsyou can read how to add scripts to the autostart that they perform automatically after the boot.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 12
4.2.3 SHUTDOWN-TIMER
The StromPi 3 has a Shutdown timer which cuts the power supply to the Raspberry Pi automatically if the primary power source fails.
You can change the time that will pass before the StromPi cuts the power to the raspberry.
If you have set the shutdown timer to 600 (600 → 10 minutes) the system reacts like:
If the StromPi 3 detects a power failure on the main power supply it will start the timer. After 10 minutes the StromPi cuts the power to the Raspberry Pi. Additionally, we offer you a script which can detect a power failure through the serial console or with a GPIO pin and begin the safe shutdown of the Raspberry Pi.
The Shutdown timer can be setup with the Configscript in point Shutdown Timer“.
To activate the shutdown timer set Choose Shutdown Modeto Enable and write down the desired time in seconde in the field next to it.
At the end confirm with Update.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 13
4.2.4 ALARM-MODE
The StromPi 3 has the possibility to boot and shutdown the Raspberry time -controlled.
The combination of WakeUp and PowerOff alarm lets you configurate the start-stop­behavoiur for the Raspberry Pi (for example every day at 10:45 AM is the boot and the shutdown is at 1:00PM). This way your Raspberry is only running when the occuring duties have to get processed in this time window.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 14
4.2.5 POWER-OFF-ALARM
The PowerOff alarm allows the Raspberry to shut down at the preset time every day. Although, the Raspberry Pi can be only shutdown with this mode once a day.
To shut down the StromPi 3 time-controlled start the Configscript:
Switch the Choose PowerOff alarm modeto Enable to activate the PowerOff alarm. The time to shutdown the Raspberry can be put in the 2 boxes on the right next to it. The Choose Power-Off Minuteshave to be set in minutes and the Choose Power-Off Hours in hours.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 15
4.2.6 WAKE-UP-ALARM
The Wake-Up alarm allows you to start the Raspberry time-controlled. Additionally, you have the opportunity to start it at a particular date or at a particular weekday.
To start the StromPi 3 time-controlled start the Configscript:
Switch the Choose WakeUp-Alarm Modeto Enable to activate the WakeUp-alarm. The time when the Raspberry Pi has to start can be filled in the boxes on the right next to it. Choose WakeUp-Alarm Minuteshas to be set in minutes and Choose WakeUp-Alarm Hoursin hours. The Raspberry Pi is only able to start once with this mode a day.
Depending what you have setup by Choose Alarm Modethe Raspberry starts daily,
weekly or only to particular dates at the chosen time
Alarm mode1 starts your Raspberry every daily at the preset time.
Alarm mode2 starts your Raspberry at a particular date at the preset time.
Alarm mode3 starts your Raspberry at a particular weekday at the preset time.
Alarm mode4 activates the Minute Wakeup Alarm
The Alarm-Mode refers only to the WakeUp alarm, it does not have any influence on the
PowerOff alarm.
Attention! Your Raspberry Pi is only capable to start with the WakeUp -alarm, if it got shutdown with the PowerOff alarm or manually with the serial command
poweroff“.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 16
4.2.7 MINUTE WAKEUP ALARM
The Minute wakeup alarm allows you to set a timer that will start the raspberry after it got shutdown through the Poweroff Alarm or the poweroffcommand.
You have to activate the mode in the Configscript. Click on Choose Alarm Modeand select „4 = Minute Wakeup-Alarm“.
After that you have to choose the time (the timer is set to minutes).
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 17
4.2.8 INTERVAL FUNCTION
The interval function allows to define time intervals when the Raspberry shuts down and starts with the StromPi 3. This function can be activated and configurated with the configscript in point interval timer“.
Switch the Choose Interval-Alarm Mode:to Enable to activate the interval function.
The On-Time in minuteswill determine how long the raspberry will be running.
Specify in Interval On-Time in minutesthe time how long the Raspberry Pi has to be switched off in minutes.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 18
The Serialless mode allows to suppress any serial communication of the StromPi with which you can use another HAT which uses the serial interface at the same time as the StromPi. However, it inhibits the configuration of the StromPi 3. For that reason it is advisable to configurate the StromPi bevor activating the Serialles mode. Additionally, the Shutdown-Warning will not occure on the serial interface as before with
this mode it will occure on a free GPIO pin.
To activate the Serialles mode you have to set Choose Serialles Modeto Enable.
Then you have to run the script Start_Serailles.py“.
If this is done, the Serialles mode is activated and the serial communication is suppressed.
To terminate the Serialless mode , you have to run the script Stop_Serialless.py“. This script set the GPIO pin to low. If it is low for more than 5 seconds, the Serialless mode gets deactivated.
5.1 SERIALLESS MODE
The used scripts need Python3.
For this mode a Serialless modification is necessary which is described in chapter 8 “Modifications“.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 19
To show you one of the many possibilities of application we created a script (RTCSerailles.py) which deactivtes the Serailles mode after starting the script until the real ­time clock is synchronized. After that the Serialles mode is activated again.
Here is the console output after a successfull running of the script:
5.2 EXAMPLE OF USAGE WITH REAL-TIME CLOCK
5.3 POWERON-BUTTON
The funcon of the PowerOn buon allows aer shut down of the StromPi with a PowerO“-command or with the PowerO-alarm without seperang the voltage source or without removing the BaeryHATs to restart it.
For this funcon is a minor modicaon necessary. There has to be a cable bridge between two solder pads. Aer this it is possible for the StromPi 3 to restart by shorng the Reset pins.
If the StromPi 3 is already modied for the Serialless mode or if the Serialless mode want to be used with the PowerOn buon modicaon, you must perform another minor modicaon.
In chapter 8 Modicaonsis the explanaon for the modicaon.
IMPORTANT: The adjusted me in the conguraon script is the inializaon me of the PowerOn buon. We recommend a minimum me of 30 seconds
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 20
The Powersave mode allows to reduce the power consumption of the StromPi 3 through a voltage transformer which will be deactivated if the Wide port is not in use and is only
activated if a power failure is detected on the primary power source. This is only possible if
the amperage is low. (under 2.5 ampere) If the voltage level is too high, it is possible that the powerpath switching could fail. To Activate the PowerSave mode the shown jumper must be switched on OFF.
Additionally, in point Choose Powersafe Mode in the Configscript must be on Enable.
5.5 POWERSAVE MODE
The Poweroff mode ensures that after a power failure your Raspberry remains off until you press the PowerOn button ( look chapter 5.3).with this mode you lose the option to recognize a power back. The Raspberry will always shutdown and the StromPi will seperate the power supply after the preset time. To activate the PowerOff mode you must setup
Enable in the Configscript in point Choose Poweroff Mode“.
5.4 POWEROFF MODE
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 21
To use all the functions of the StromPi and change the settings you have to configure your Raspberry Pi.
First you must install the python3-serial library with the following command:
Open the console of the Raspberry and enter the following command:
Add the following lines at the end of the file:
dtoverlay=pi3-miniuart-bt enable_uart=1 core_freq=250
Save the file with the key combination of Strg+O and leave the file with the combination of Strg+X.
sudo nano /boot/config.txt
sudo apt-get install python-serial python3-serial
6.1 ACTIVATION OF THE SERAIL COMMUNICATION
6. CONFIGURATION OF THE STROMPI 3
In this chapter we show you how to setup the serial communication of your StromPi. This manual is based on the Raspbian Stretch version of April 2019. We recommend the use of the newest version of the Raspbian Stretch images.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 22
Additionally it is necessary to activate the Raspberry Pis serial interface and deactivate the serial console. You can do this with the Raspberry Pi configuration or with the Rasp -Config.
To do this with the Raspi-Config enter the following command in the terminal window at
your Raspberry:
Navigate with the arrow keys to the point 5 Interfacing Options“.
Choose point P6 Serial“.
sudo raspi-config
6.1 ACTIVATION OF THE SERAIL COMMUNICATION
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 23
Answer the question “Would you like a login shell to be accessible over serial?“ with “No“.
Answer the question Would you like the serial port hardware to be enabled?with Yes“.
After a confirmation you can leave the menu with Finish“. The question if you want to restart the device has to be answered with Yes“. The serial interface is now activated and the serial console deativated.
6.1 AKTIVIERUNG DER SERIELLEN KOMMUNIKATION
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 24
6.2 EXECUTION OF THE GUI SCRIPT
Attention! The StromPi configscript does not work with the CLI version of the StromPi firmware, only the main version of the firmware supports the script. Addi­tionally the serial communictaion has to be activated [ look chapter 6.1 Activation of serial communication“]
To run the configurationscript on your Raspberry Pi you have to install a library first which you can do with the following command:
There are 3 possibilities to run the grafical interface.
For the usage of VNC you have to run the following command:
under Interfacing options“→“VNCyou have to set it on. After that you have to get your IP address with the following command.
Download RealVNC on your device from which you want to controll the Raspberry Pi and
connect them through entering the IP address.
Now following window should appear:
With the console you can work as usual with your linux system.
sudo apt-get install python3-pil python3-pil.imagetk
6.3 VNC FOR REMOTE DESKTOP CONNECTION
sudo raspi-config
ifconfig
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 25
Run the following command:
Choose Interfacing Opons
Aer that acvate SSH
Now you have to download PuTTY and Xming . Start the le XLaunch.exe in the installaon directory of Xming.
Choose Mulple Windowsand aer that enter in Display number0.
sudo raspi-config
6.4 SSH-CONNECTION WITH PUTTY AND XMING
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 26
Ensure that Start no client is chosen:
Press Next without any changes:
Press Finish:
6.4 SSH-CONNECTION WITH PUTTY AND XMING
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 27
Now you have to setup PuTTY. Ensure you have selected Session“ “SSHand put the IP address of you Raspberry Pi in the Host Name text box.
Ensure you have turned Enable X11 forwardingin point X11to on and put localhost:0.0in X display locaon“.
Press on Openand you should see the following:
Fill in your login data.
You have successfully established a SSH connecon.
6.4 SSH-CONNECTION WITH PUTTY AND XMING
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 28
Enter following command:
Now the gracal surface should appear. It should look like this:
The shown values will be synchronized at the start of the script with the seng of the StromPi. You can now change values individually and with the Press on Updatethe sengs will be saved.
6.4 SSH CONNECTION WITH PUTTY AND XMING
sudo –E python3 strompi_config_gui.py
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 29
Ensure that SSH is acvated. If it is not setup already look at the last chapter how to acvate the SSH.
As the next step download MobaXTerm.
Press on Sessionnow and choose SSH. Put your IP adress in the remote host texield and in next to Specify usernameyou put pi“. Aer that press OKand enter the password of the Raspberry Pi when it is asked.
With this command:
You can start the gracal interface script.
6.5 SSH CONNECTION WITH MOBAXTERM
sudo –E python3 strompi_config_gui.py
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 30
The gracal surface should look like the following:
The shown values will be synchronized at the start of the script with the seng in the StromPi. You can now change values individually and with the Press on Updatethe sengs will be saved.
It is possible that your script will look dierent. The PowerO mode and the Powersave mode we­re added at a more recent rmware version.
6.5 SSH CONNECTION WITH MOBAXTERM
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 31
All our published scripts for the StromPi 3 can be downloaded here. Additionally to the configscript which you already know there are the following scripts: The serial scripts read and send necessary information through the serial interface instead
of the Serailless scripts which will use a GPIO pin.
7.1 SERIAL SCRIPTS
serialShutdown.py
This script shuts down the Raspberry Pi if the primary power source fails. The script has his own shutdown timer which sets the time to wait primary power source to return prior to the Raspberry Pi shuts down. The default time is 10 seconds. You can customize the time in line 14 of the script.
The shutdown timer in the script must be lower than the shutdown timer which you can set in the configscript because otherwise the power supply of the Raspberry will be seperated prior to the shut down. You want to have this script in the autostart of your Raspberry Pi. A manual can be found in chapter 7.4 Automatic execution of scripts“.
shutdown.py
This script shuts down your StromPi and Raspberry Pi with the PowerOff command. This command enables the StromPi to start with the WakeUp alarm.
RTCSerial.py
This script compares the time of the Raspberry Pi with the time of the RTC of the StromPi and the older one gets overwritten with the more recent one.
If this script is in the autostart of your Raspberry Pi, the time gets automatically compared
with every restart of the Raspberry Pi.
A manual can be found in chapter 7.4 Automatic execution of scripts“.
7 STROMPI 3 SCRIPTS
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 32
7.1 SERIAL SCRIPTS
Poweralarm_serial.py
This script sends a email at the stated email in the script if the primary voltage source fails. A further email will be send if the primary voltage source comes back or if the Raspberry restarts.
In line 22 can be the notification email at the restart be turned on (1) or off (0).
SERVERis your SMTP E-Mail server (for example smtp.your-e-mail-server.com) PORTis your server port EMAILis your email address PASSWORTis your email password EMPFAENGERare the email addresses which get the emails SUBJECT_Powerfailis the reference by power failure in the email SUBJECT_Powebackis the reference by return of the power in the email
The script must be at autosart of your raspberry Pi that it can work. A manual can be found
in chapter 7.4 Automatic execution of scripts“.
In chapter 7.3 Raspberry Pi Pin-layoutis the layout of the pins of the Raspberry Pi shown.
7 STROMPI 3 SCRIPTS
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 33
7.2 SERIALLESS SCRIPTS
poweralarm_serialless.py
This script sends a email at the stated email in the script if the primary voltage source fails. A further email will be send if the primary voltage source comes back or if the Raspberry restarts. With the Serialless mode the power failure will be detected through a GPIO pin.
In line 11 of the script you can change the GPIO-pin which you use as an alternative communication for the serialless mode. In line 14 the notification email at the restart can be turned on (1) or off (0).
SERVERis your SMTP E-Mail server (for example smtp.ihr-e-mail-server.de) PORTis your server port EMAILis your email address PASSWORTis your email password EMPFAENGERare the email addresses which get the emails SUBJECT_Powerfailis the reference by power failure in the email SUBJECT_Powebackis the reference by return of the power in the email
The script must be at autosart of your raspberry Pi that it can work. A manual can be found in chapter 7.4 Automatic execution of scripts“.
In chapter 7.3 Raspberry Pi Pin-layoutis the layout of the pins of the Raspberry Pi shown.
7 STROMPI 3 SCRIPTS
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 34
7.2 SERIALLESS SCRIPTS
powershutdown_serialless.py
This script shuts the raspberry down if the primary power source fails. The script has its own shutdown timer which determines the time which will be waited if the power supply returns prior to the shutdown of the Raspberry Pi. The defualt time is 10 seconds. You can customize the time in line 11 as well as the GPIO-pin for the alternative communication for the Serialless mode (line 10).
The shutdown timer in the script must be lower than the shutdown timer which you can set in the configscript because otherwise the power supply of the Raspberry will be seperated
prior to the shut down.
In chapter 7.3 Raspberry Pin-layoutyou can see the layout of the pins of the Raspberry Pi. You need this script at the autostart of your Raspberry Pi that it will work. A manual can be found in chapter 7.4 Automatic execution of scripts“.
RTC_serialShutdown_serialless.py
This scrpit has all functions of the powershutdown_serialless.py script and compares additionally the time of the StromPi and the Raspberry Pi at the start. The older one gets overwritten with the more recent one.
The shutdown-timer and the GPIO-pin which you use as an alternative communication for the serialless mode can be changed in line 11 and 12.
The shutdown timer in the script must be lower than the shutdown timer which you can set in the configscript because otherwise the power supply of the Raspberry will be seperated
prior to the shut down.
In chapter 7.3 Raspberry Pin-layoutyou can see the layout of the pins of the Raspberry Pi. You need this script at the autostart of your Raspberry Pi that it will work. A manual can be found in chapter 7.4 Automatic execution of scripts“.
7 STROMPI 3 SCRIPTS
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 35
7.2 SERIALLESS SCRIPTS
RTC_EMail_serialless.py
This script compares the time of the Raspberry with the time of the StromPi and the older one gets overwritten from the more recent one. Additionally it sends an email to the set email address if the power fails. Another email will be sent if the primary voltage source returns or the Raspberry Pi restarts.
In line 14 of the script you can change the GPIO-pin which you use as an alternative communication for the serialless mode. In line 17 the notification email at the restart can
be turned on (1) or off (0).
SERVERis your SMTP E-Mail server (for example smtp.ihr-e-mail-server.de) PORTis your server port EMAILis your email address PASSWORDis your email password EMPFAENGERare the email addresses which get the emails SUBJECT_Powerfailis the reference by power failure in the email SUBJECT_Powebackis the reference by return of the power in the email
In chapter 7.3 Raspberry Pi Pin-layoutis the layout of the pins of the Raspberry Pi shown.
The script must be at autosart of your raspberry Pi that it can work. A manual can be found in chapter 7.4 Automatic execution of scripts“.
7 STROMPI 3 SCRIPTS
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 36
7.2 SERIALLESS SCRIPTS
RTCSerialless.py
This script was written particular for the Serialless mode. At the start of the script the Serialless mode will be closed so that the time of the Raspberry Pi and the StrompiPi can be compared and the older one can be overwritten with the more recent one. After that the Serialless mode is activated again. Because of the deactivated serial communication is it not possible to make changes with the configuration of the StromPi. In line 9 of the script you can customize the GPIO -pin which is used as an alternative communication for the Serialless mode.
To close the Serialless mode you have to set the communication pin for a minum of 5 seconds on Low“. In chapter 7.3 Raspberry Pi Pin-Layoutyou cann see the layout of the pins.
If the script is at autostart of the Raspberry Pi, the time will be automatically set by every start of the Raspberry and the Serialless mode activated after that. A manual can be found in chapter 7.4 Automatic execution of scripts“.
Start_Serialless.py
This script starts the Serialless mode to suppress all serial communication between the Raspberry Pi and the StromPi.
In line 9 of the script the GPIO-pin can be customized which is used as an alternative communication of the Serialless mode.
In chapter 7.3 Raspberry Pi Pin-Layoutyou can see the layout of the pins.
Stop_Serialless.py
This script closes the Serialless mode to enable the communication between StromPi and Raspberry Pi again. In line 9 you can customize the GPIO -pin which is usedas an alternative communication for the Serialless mode
In chapter 7.3 Raspberry Pi Pin-Layoutyou can see the layout of the pins.
7 STROMPI 3 SCRIPTS
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 37
7.3 RASPBERRY PI PIN-LAYOUT
Here you can see here the layout of the pins:
1 3.3V DC 3 GPIO 2 (SDA1, I2C) 5 GPIO 3 (SCL1, I2C) 7 GPIO 4
9 Ground 11 GPIO 17 13 GPIO 27 15 GPIO 22
17 3.3V
19 GPIO 10 (SPI, MOSI) 21 GPIO 9 (SPI, MISO) 23 GPIO 11 (SPI, CLK) 25 Ground 27 ID_SD (I2C, EEPROM) 29 GPIO 5 31 GPIO 6
33 GPIO 13
35 GPIO 19 37 GPIO 26 39 Ground
2 5V DC 4 5V DC 6 Ground
8 GPIO 14 (TXD0) 10 GPIO 15 (RXD0) 12 GPIO 18 14 Ground 16 GPIO 23
18 GPIO 24
20 Ground 22 GPIO 25 24 GPIO 8 (SPI) 26 GPIO 7 (SPI) 28 ID_SC 30 Ground 32 GPIO 12
34 Ground
36 GPIO 16 38 GPIO 20 40 GPIO 21
GPIO-Board number:
GPIO-Board Number:
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 38
Scripts can be copied to the autostart of the Raspberry Pito get executed at the start:
Here can the script be added. The following command must be added for the command
"exit 0".
Example for the RTCSerial.py-Script:
Should you have not copied the script into the folder "/home/pi" you must adapt the path.Save the file with the key combination STRG+O, confirm with Enter and leave the editor with the combination STRG+X.
The changes are after a restart effective.
python /home/pi/Skriptname.py &
sudo nano /etc/rc.local
7.4 AUTOMATIC EXECUTION OF SCRIPTS
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 39
In the following chapters are all modifications for some function of the StromPi and how to use them described.
8 MODIFICATIONS
8.1 Serialless Mode
For the modification for the Serialles mode are 3 different variation which are explained in the following.
Variation 1
Variation 1 is the fastest solution but can only be used if you do not use the battery hat. You only have to plug a cable on to the Reset -pin which is shown on the following picture. To do that you only have to remove the Jumper
The other end of the cable must be pluged on the GPIO -pin.
YOu can use every other pin either but the software must be adjusted to the change.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 40
8.1 Serialless Mode
VARIATION 2
Solder one end of the cableon to the free pad like shown in the picture.
Note that the Jumper at the Reset -pin have to be plugged in for that.
The other end of the cable is like in picture 1 plugged on to the free GPIO -pin.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 41
8.1 Serialless Mode
VARIATION 3
For variaon 3 you have to solder one end of the cable on the free pad at the Reset-pins. The jumper sll has to be set here.
The other end of the cable have to be soldered at one GPIO-pin like shown in the picture.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 42
8 MODIFICATION
8.2 PowerOn button
The both red-marked pads to solderhave to be bypassed with a cable.
Give some solder on both pads. Solder one end of the cable on the upper pad.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 43
8.2 PowerOn button
At the last step, the other end of the cable must be soldered at the lower pad.
Now the system is able to restart after a PowerOffcommand through short of the red­marked Reset-pins. When it is running the jumper should not be set. To make it more comfortable it is possible to add a switch at the pins to short-circuit them for a restart.
IMPORTANT: Between PowerOand a restart must be a minimum of 30 seconds.
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 44
Because the pad that is used for the serialless modifikation is occupied the cable for the serialless mode has to be soldered at the red -marked pad for the Serialless mode.
8.3 SERIALLESS + POWERON BUTTON MODIFICATION
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 45
For more information about the Serialless mode please read the chapter about the Serialless mode.
8.3 SERIALLESS + POWERON BUTTON MODIFICATION
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 46
To change settings manually with the StromPi console you must download Minicom and install it. After that enter the following commands:
After Minicom is successfully installed, you can start a serial connection to the StromPi3
with the following command:
You open the serial console with:
Or the shortage:
The serial console of the StromPi 3 should open now. The current configuration settings of your device can be looked up with the command show-status.
A general overview gives you the command help.
With the key combination of Strg + A + X , Enter you are closing Minicom.
With the key combination of Shift+ Page up / down you can scroll through the terminal window. The mouse wheel works either.
startstrompiconsole
Attention! The system is waiting for an input and it is likely that you dont see your keystrokes. Enter the following command and confirm this with Enter even if you do not see your input.
sudo minicom -D /dev/serial0 -b 38400
sudo apt-get update sudo apt-get install minicom
sspc
9 OPENING OF THE SERIAL CONSOLE OF THE STROMPI 3
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 47
Should aer the input of the following command:
Port /dev/y8(like shown in the picture below) and not Port /dev/serial0show up you have to con­gurate Minicom manually.
To do that enter following command:
You should see the following window:
Choose Serial port setup and the following window should appear:
Press Aand change „/dev/y8to „/dev/serial0“. Conrm with Enter.
sudo minicom -D /dev/serial0 -b 38400
sudo minicom -s
9 OPENING OF THE SERIAL CONSOLE OF THE STROMPI 3
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 48
Enter an Eand this window appears:
Press Dto set a baud rate of 38400. Conrm this two mes with Enter to return to the conguraon menu. Aer that press on Save as dand the following window should appear:
You can leave with ESCthe conguaron menu and aerwards press Strg + A“. Now you see at the console the following:
If it looks the same like the picture above, your Minicom is successfully congurated. You can enter the following commands now to start Minicom:
Now you can open the Strompi Console with:
Or with the shortage:
On the following two sites are all StromPi console commads listed.
sudo minicom
startstrompiconsole
sspc
9 OPENING OF THE SERIAL CONSOLE OF THE STROMPI 3
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 49
Commands for the CLI and main rmwareversions
Start StromPi console:
oder
Close StromPi console:
List all commands:
Setup the me of the RTC of the StromPi:
Setup of the date of the RTC of the StromPi:
Output of the measured voltage:
Setup of the StromPi modes (<1>: mUSB -> Wide, <2>: Wide -> mUSB, <3>: mUSB -> Bat, <4>: Wide -> Bat, <5>: mUSB -> Wide -> Bat, <6>: Wide -> mUSB -> Bat):
Output of the current me of the RTC of the StromPi:
Display the current global sengs:
Display the current alarm sengs:
Shut down the Raspberry P with the StromPi:
Commands for the CLI rmwareversion
Set the shutdown mer in seconds:
Acvate <1> or deacvate <0> the Raspberry Pi shutdown:
quit
help
set-clock <hour> <minutes> <seconds>
set-date <day> <month> <year> <weekday>
show-status
adc-output
strompi-mode <number>
time-output
show-alarm
poweroff
startstrompiconsole sspc
10 STROMPI 3 CONSOLE COMMANDS
set-timer <shutdown-seconds>
Shutdown-enable <option>
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 50
Acvate <1> or deacvate <0> the warning by failure of primary power supply:
Setup of Wakeup alarms (<1>: me, <2>: date, <3>: weekday):
Acvate <1> or deacvate <0> the Wakeup alarms:
Setup of the me of the Wakeup alarms:
Setup of the weekday of the Wakeup alarms:
Setup of the date of the Wakeup alarms:
Setup of the me of the PowerO alarms:
Acvate <1> or deacvate <0> the PowerO alarms:
Acvate <1> or deacvate <0> the Serialless modes:
Setup of the voltage of the baery when the Raspberry Pi is shutdown (<0>: deacvated, <1>: < 10%, <2>: < 25%, <3>: < 50%):
Acvate <1> or deacvate <0> the PowerO interval alarms:
Setup of the Onme of the interval alarms:
Setup of the Oime of the interval alarms:
Acvate <1> or deacvate <0> the PowerOn buons:
Setup of the me of the PowerOn-Buon inializaon:
Warning-enable <option>
alarm-mode <mode-number>
alarm-set-date <date> <month>
alarm-enable <option>
alarm-set-time <hour> <minutes>
alarm-set-weekday <weekday>
poweroff-set-time <hour> <minutes>
poweroff-enable <option>
serialless-mode <option>
batlevel-shutdown <level-number>
10 STROMPI 3 CONSOLE COMMANDS
interval-enable <option>
interval-ontime <min>
interval-offtime <min>
poweronbutton-enable <option>
poweronbutton-timer <seconds>
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 51
11 SUPPORT
We also support you after your purchase. If you have any questions left or encounter any problems, feel free to contact us by email, phone or with our ticket -supportsystem on our
website.
E-Mail: service@joy-it.net Ticket-System: http://support.joy-it.net Telefon: +49 (0)2845 98469 66 (10 - 17 oclock)
For further information please visit our website:
www.joy-it.net
StromPi 3
Publis hed: 09.0 7.2019 Copyright by J o y-IT 52
Manufacturer: Simac GmbH Pascalstr. 8 47506 Neukirchen-Vluyn
Article: JOY-IT StromPi 3 Description: USV / Wide power supply Raspberry PI 3 & other SBC (SingleBoardComputer) 5V Purpose: Application in Prototyping / Experimental setup
Confirms that the product JOY-IT StromPi 3“ if it is used as intended, the requiremnets of the following guidelince are fulfilled:
2014/30/EU (EMC) & 2011/65/EU (RoHS)
The following norms have been used to assess this device: EN 55022:2010+ AC:2011, EN 55024:2010, EN 61000-3-2:2014, EN 61000-3-3:2013
Date Name of person in charge Signature Position in buisness
24.08.2018 Xu Lu Manager
12 EU-DECLARATION OF CONFORMITY
Loading...