-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.json
1 lines (1 loc) · 39.4 KB
/
content.json
1
{"pages":[{"title":"About this","text":"Purpose of this site Author What is Practical IOT House? Purpose of this site About the hardware and software of the IOT House that has been under development for many years Computers, peripherals, networks, and IT fairy tales that you have experienced so far I hope it will be a hint for an environment where parents can compliment and raise their children. Practical use of things that children have learned from experiments and play-> Parents are pleased-> Parents praise children-> Children learn more and devise to get praise-> Parents children Compliment-> Children grow up-> Society grows up Author kujiranodanna: A long time ago 1970s Computer peripherals and network equipment maintenance, network engineers, part-time lecturers at IT vocational schools, part-time lecturers at universities (information basics), building management in recent years People who develop and practice IOT house using Raspberry Pi or old PC and Linux What is Practical IOT House? It is a home appliance automation, crime prevention, disaster prevention, voice response, monitoring and control system. It is built with shell script, C, javascript and can be operated with a browser. Check the room temperature from the outside and operate the cooler Turn on the lights of the entrance and room when it gets dark outside in the evening Watering the vegetable garden at dawn based on the outside humidity Email a video when the security sensor works Play music at a fixed time Notify by e-mail and phone (wangiri) when the fire detector issues a report The underfloor ventilation fan is operated intermittently based on the outside air humidity. Introduced additional Homebridge Alexa, voice and remote control of home appliances with Alexa app Let’s realize home electronics & home security with Raspberry Pi that is stowed in the back of the desk https://iot-house.jpn.org","link":"/about/index.html"}],"posts":[{"title":"About this","text":"Purpose of this site Author What is Practical IOT House? Purpose of this site About the hardware and software of the IOT House that has been under development for many years Computers, peripherals, networks, and IT fairy tales that you have experienced so far I hope it will be a hint for an environment where parents can compliment and raise their children. Practical use of things that children have learned from experiments and play-> Parents are pleased-> Parents praise children-> Children learn more and devise to get praise-> Parents children Compliment-> Children grow up-> Society grows up Author kujiranodanna: A long time ago 1970s Computer peripherals and network equipment maintenance, network engineers, part-time lecturers at IT vocational schools, part-time lecturers at universities (information basics), building management in recent years People who develop and practice IOT house using Raspberry Pi or old PC and Linux What is Practical IOT House? It is a home appliance automation, crime prevention, disaster prevention, voice response, monitoring and control system. It is built with shell script, C, javascript and can be operated with a browser. Check the room temperature from the outside and operate the cooler Turn on the lights of the entrance and room when it gets dark outside in the evening Watering the vegetable garden at dawn based on the outside humidity Email a video when the security sensor works Play music at a fixed time Notify by e-mail and phone (wangiri) when the fire detector issues a report The underfloor ventilation fan is operated intermittently based on the outside air humidity. Introduced additional Homebridge Alexa, voice and remote control of home appliances with Alexa app Let’s realize home electronics & home security with Raspberry Pi that is stowed in the back of the desk https://iot-house.jpn.org","link":"/2021/06/20/about_me/"},{"title":"Security camera application","text":"Introducing the applied technology of security cameras with Doppler sensor RCWL-0516 and module camera Switch between photos during the day and video during the night using the Module Camera or Web Camera.― Sufficient lighting is required for nighttime videos, but photographic images can be recognized even if they are relatively dark. Distributed processing is realized by two separate Raspberry Pis for Module camera connection and Doppler sensor connection. Appropriate names for Inputs 1 and 3, here “security sensor” and “remote control” DIO contorl1 Action: High-> Low Module camera photo mail Remote control Action: High-> Low Module camera video mail set respectively The setting of the Raspberry Pi to which the Module camera is connected is complete. Next, set the Raspberry Pi to which the Doppler sensor RCWL-0516 is connected. Named “Camera valid” for time control to Output4, Output4 is reflected in Iutput4 by inverting the output of Iutput4 and direct connection Output4 DIO contorl1 Action: High-> Low of security sensor, reset registration only, counter generation only, Action does not set anything Switch “Camera enabled” between 18:00 and 06:00 in Auto process. Add in editor to the end of the /usr/bin/dio0low script automatically generated by Action: High-> Low of the security sensor with DIO contorl1 Meaning is that Input4 of json data is High-> Module Execute dio0low of Raspberry Pi to which the camera is connected, if Low, execute dio2low[iot00f:root#] vi /usr/bin/dio0low123456ENABLE=`cat /www/remote-hand/.di_read_data.json |jq -r .di3`if [ $ENABLE = “high” ];thenpepoalexado iot02f remote hand dio0lowelsepepoalexado iot02f remote hand dio2lowfi Addition, you can get the output information of Output4 below, so you may judge with this123[iot00f:root#] cat /www/remote-hand/.di_read_data.json |jq -r .do3low <-resulthigh or low","link":"/2021/01/29/advanced_doppler_sensor/"},{"title":"Automation settings","text":"Automatically run with Linux cron Set to start / stop every minute. For example, you can set input conditions. When the room temperature rises, turn the fan for a certain period of time. Turn on or off the light with outdoor brightness. Can be set between 1 and 300,000 milliseconds.","link":"/2021/01/07/auto_process/"},{"title":"Environmental gas sensor BME680","text":"Temperature / humidity / barometric pressure / gas sensor module BME680 is operated by Rasberry pi. Download bme680.h, bme680_defs.h from Github Bosch Sensortec. Download pepobme680.tar.gz from the osdn site.12cc pepobme680.c bme680 -o pepobme680./pepobme680 It keeps outputting the following contents to /www/remote-hand/tmp/.pepobme680 about every 10 seconds.Date and time, temperature, humidity, atmospheric pressure, gas resistance12[iot02f:root#] cat /www/remote-hand/tmp/.pepobme6802021/01/29/17:13:48,10.3,62.7,1016.1,5089877","link":"/2021/01/10/bme680/"},{"title":"basic setting","text":"Access http://HOST_NAME.local or http://HOST_NAME with a web browser and log in.username: remotepassword: hand On the DIO Setting tab, set the input and output terminal aliases, IRkit, monaural wireless module, modem, and so on. Output settings Input settings Email settings(when using gmail) Save settingsSet and save login user and password (save various settings)","link":"/2021/01/05/config/"},{"title":"gmail settings","text":"Mail settings (when using gmail) It is a setting for command response with gmail You can operate IOT-House commands and responses remotely via Gmail. Command output terminal High / Low, response input terminal High / Low status, temperature, humidity, barometric pressure, air quality values, graphs, photos, videos, etc. Checks new emails every Email check interval hourly, executes the keyword content that matches Subject (keyword), and returns a response. Email settings tab You can operate IOT-House commands and responses remotely via Gmail. Command output terminal High / Low, response input terminal High / Low status, temperature, humidity, barometric pressure, air quality values, graphs, photos, videos, etc. Mail commandTo: [email protected]: iot009Body: noneMail ResponseFrom:root <[email protected]>Date: Tuesday, September 22, 2020 10:53 10:53To:[email protected]:iot009 IOT-House reportBody: Continued below==input list==1:火事です=high2:扇風機スイッチ=low3:Input3=high4:出力4と接続=high5:Input5=none6:Input6=none7:Input7=none8:Input8=none9:防犯センサー=high10:Input10=high11:Input11=high13:屋外照度=high14:Input14=none15:Input15=none16:Input16=none17:CPU温度=high18:部屋の温度=low19:部屋の湿度=low0:外気温度=high21:外気湿度=low22:気圧=high23:ガス=high24:空気=low==output list==1:換気扇=high2:電気=low3:Outnput3=low4:入力4と接続=high5:Outnput5=none6:Outnput6=none7:Outnput7=none8:Outnput8=none9:ななちゃん天井電灯10:冷房1:エアコン12:暖房13:天井電気14:サーキュFAN15:散水ポンプ=low16:Outnput16=none17:玄関電灯=low==Other Command==21:CPU Temperature22:GPIO Temperature&Humidity23:No1 Camera Movie24:No1 Camera Picture25:No2 Camera Movie26:No2 Camera Picture27:No3 Camera Movie28:No3 Camera Picture29:Module Camera Movie30:Module Camera Picture31:Twlite Temperature&Humidity32:CPU Temperature&Graph33:GPIO Temperature&Graph34:GPIO Humidity&Graph35:Twlite Temperature&Graph36:Twlite Humidity&Graph37:GPIO Pressure&Graph38:GPIO Gas&Graph39:GPIO IAQ&Graph40:GPIO Last Hour CSV Data Request temperature graphTo: [email protected]: iot009 33Body: noneMail ResponseFrom:root <[email protected]>Date: Tuesday, September 22, 2020 12:53 10:53To:[email protected]:iot009 IOT-House reportBody : GPIO Temperature Graph Report","link":"/2021/01/06/config_gmail/"},{"title":"Input settings","text":"Input name setting Name the input, the name you set is to make it easier to understand with other settings. Set the input alias, temperature, humidity and case analog value slices on the DIO Setting tab.","link":"/2021/01/05/config_input/"},{"title":"I/O event settings","text":"DIO Control-1 Sets the operation to start when the input terminal changes from High to Low or Low to High. There are two tabs to set the operation to start. On the first tab, you can set to start operations, reset counters, and view logs. DIO Control-2","link":"/2021/01/21/config_input_event/"},{"title":"Output settings","text":"Output name setting Name the output, the name you set is to make it easier to understand in other settings.","link":"/2021/01/05/config_output/"},{"title":"config_twelite","text":"Make a simple illuminometer with a solar panel of a one dolloar calculator Measure the generated voltage of the solar panel with the analog input of TWELITE DIP Graph the analog input voltage, correct the variation of the generated voltage depending on the measurement location with the slice voltage, and digitize it as high/low Detect sunrise and sunset at high/low, turn on/off the entrance lamp Do not simply turn the entrance lamp on and off at high/low (sunset/sunrise) Turns off for 30 seconds (30000ms) every 5 minutes in consideration of crime prevention and energy saving. Specific settings are done in Auto Process Tab Every 5 minutes from 17:00 to 24:00, outdoor illuminance=low is judged and entrance lamp->low(30seconds)30 seconds after turning off, it lights for about 4 and a half minutes. Every 5 minutes from 0 to 6 o’clock, Outdoor illuminance=low is judged and Entrance lamp->low(30seconds) Every 5 minutes from 5 to 7 o’clock, Outdoor illuminance=high is judged and entrance lamp->low The lamp turns off after sunrise Collaboration video of Raspberry_pi and Tocos wireless module","link":"/2021/02/07/config_twelite/"},{"title":"config_irkit","text":"What is IRkit IRKit is a network-compatible learning infrared remote controller At the IOT House, the Raspberry pi reads infrared data from the IRkit via WiFi, sends it on time and at each input event, and operates home appliances. Infrared data of home appliances is read from IRkit, and transmission, scheduled operation, and operation by input event are all performed from a Web browser. If you do not know the IP address of IRkit, press the Search_Set button in the state of DIO Settings TAB text box none from the Web browser, and the IP address of IRkit will be After a few minutes, it will be automatically detected and displayed, and then perform the following operations. IP address auto-discovery is only possible if the Raspberry pi and IRkit IP addresses are configured in C class. Please check the source code belowhttps://github.com/kujiranodanna/IOT-House/blob/master/raspberrypi/www/remote-hand/irkit_search.cgi Infrared to IRkit Immediately after operating the remote controller, read the infrared data of home appliances from IRkit with a Web browser. (Data can be read only immediately after operating the infrared remote controller and buttons) Read the infrared data of home appliances from IRkit with Raspberry pi with the following GET command.1# curl -s -m $RETRYTIME --retry $RETRY --user-agent ${USERAGENT} http://${IP}/messages --header "X-Requested-With: PepoLinux" >${IRFILE} The read data is stored in the following json format, which is sent out at each timing to operate home appliances.12# cat .irdata_0{"format":"raw","freq":38,"data":[3968,1927,10762,1927,2911,1037,2911,1037,843,1111,843,1111,843,1111,843,1111,843,1111,843,1111,2813,1073,843,1111,843,1111,843,1111,843,1111,843,1111,843,1111,2911,1037,1037,1037,2911,1037,843,1111,843,1111,843,1111,843,1111,843,1111,843,1111,968,968,843,1111,843,1111,843,1111,843,1111,843,1111,843,1111,843,1111,968,968,2911,968,843,1111,2911,1037,2911,1037,843,1111,2911,1037,2911,1037,843,21415,3834,1927,10762,1927,2911,1037,2911,1037,843,1111,843,1111,843,1111,843,1111,843,1111,843,1111,2813,1073,843,1111,843,1111,843,1111,843,1111,843,1111,843,1111,2911,1037,1037,1037,2911,1037,843,1111,843,1111,843,1111,843,1111,843,1111,843,1111,968,968,843,1111,843,1111,843,1111,843,1111,843,1111,843,1111,843,1111,968,968,2911,968,843,1111,2911,1037,2911,1037,843,1111,2911,1037,2911,1037,843,21415,3834,1927,10762,1927,2911,1037,2911,1037,843,1111,843,1111,843,1111,843,1111,843,1111,843,1111,2813,1073,843,1111,843,1111,843,1111,843,1111,843,1111,843,1111,2911,1037,1037,1037,2911,1037,843,1111,843,1111,843,1111,843,1111,843,1111,843,1111,968,968,843,1111,843,1111,843,1111,843,1111,843,1111,843,1111,843,1111,968,968,2911,968,843,1111,2911,1037,2911,1037,843,1111,2911,1037,2911,1037,843]} To read infrared data of home appliances from IRkit with Raspberry pi, use the following POST command.1# curl -s -m $RETRYTIME --retry $RETRY --user-agent ${USERAGENT} -X POST -F upfile=@/${IRFILE} http://${IP}/messages >${DOCFILE} IRkit routine operations are performed with Auto Prosess Tab. IRkit input event operations are performed with DIO Contorol Tab. Please check the source code below https://github.com/kujiranodanna/IOT-House/blob/master/raspberrypi/www/remote-hand/irkit_reg.cgi https://github.com/kujiranodanna/IOT-House/blob/master/raspberrypi/www/remote-hand/irkit_post.cgi","link":"/2021/02/15/config_irkit/"},{"title":"Security camera","text":"Use as a security camera with Doppler sensor RCWL-0516 and module camera. Since the output 0-3.3v of RCWL-0516 cannot be directly connected to the gpio input of Raspberry Pi, connect it after level conversion safely with a photo coupler. Send photo and video emails with the security camera when the Doppler sensor is activated.","link":"/2021/01/26/doppler_sensor/"},{"title":"hardware","text":"Raspberry Pi Zero Self-made board Solid State Switch AC100V Outlet BoxIt is connected in series with AC100V for protection and has a 2A resettable fuse.You can turn AC100 directly on / off with the output terminal of gpio. Installed in the bay window on the second floor, the Raspberry Pi Zero monitors outdoor surveillance cameras, room temperature, humidity, and air quality, and has three ventilation fans with the output of gpio and twelite dip Control. Activate the module camera with the Doppler sensor of Raspberry Pi for external environment monitoring installed outdoors, email videos during the day and photos at night","link":"/2021/01/03/hardware/"},{"title":"Installation","text":"Download from the URL belowhttps://osdn.jp/projects/pepolinux/releases/p14620 Please prepare the flash memory of the following capacity 12345678910111213# fdisk /dev/mmcblk0Welcome to fdisk (util-linux 2.29.2).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): pDisk /dev/mmcblk0: 7.3 GiB, 7820279808 bytes, 15273984 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dosDisk identifier: 0x15ae16d5 Extract the downloaded IOT-House_zero_w_xx.7z and write IOT-House_zero_w_xx.img to the flash memory Extract the downloaded IOT-House_zero_w_xx.7z and write IOT-House_zero_w_xx.img to the flash memory Turn on the Raspberry Pi, wait at least 3 minutes for the ACT LED to subside and then turn it off. Take out the flash memory and edit the following /boot/iothouse_config.txt by following the example with a text editor. In a Wifi environment with MAC Address filtering, register the following displayed addresses and enable filtering. ※ # Wireless address of this machine –> b8:27:eb:XX:XX:XX If you use a device that can be recognized by USB connection eth0, comment out the SSID and KEY.12345678910111213141516171819202122232425# Please describe the setting for IOTHouse below# Wireless address of this machine --> b8:27:eb:XX:XX:XX# The following is an example of a static ip address#HOST_NAME=iot000#SSID=iothouse999#KEY=999iothouse#IP_ADDRESS=192.168.1.200/24#GATE_WAY=192.168.1.1#NAME_SERVER=8.8.8.8# end of an example# The following is an example of dynamic ip address# Access is iot000.local#HOST_NAME=iot000#SSID=iothouse999#KEY=999iothouse#IP_ADDRESS=dhcp# end of an exampleHOST_NAME=SSID=KEY=IP_ADDRESS=GATE_WAY=NAME_SERVER= Insert the flash memory after editing /boot/iothouse_config.txt and turn on the Raspberry Pi again. Access http://HOST_NAME.local with a web browser and log in with username: remote password: hand ssh is username: root password: pepolinux","link":"/2021/01/04/install/"},{"title":"Save settings","text":"Save settingsSet the login user password to save (save various settings), restart, and initialize.","link":"/2021/01/08/config_save/"},{"title":"serial communication software","text":"What is serial communication software epicon? epicon is a Linux serial communication software. In practice IOT House uses the thermo-hygrometer AM2321 sensor and AI/DIO for control with TOCOS TWE-Lite via serial communication from the USB connection ToCoStick of Raspberry Pi. I think that network devices such as Switch and Router that can be configured with serial ports and console PCs can be used regardless of manufacturer or model. When automating the settings, Cisco Switch and Router copy and paste the text data created in advance and fill in the config.At this time, it is important to send delay of characters and line breaks to prevent the config data from being missed. epicon supports the transmission delay of important characters and line breaks as this serial console, and you can copy and paste the config with confidence. In addition, file transfer software such as simple telnet and zmodem, shell, macro, start of external software, etc. CUI, but it is multifunctional and compact. InstallationDownloadhttps://osdn.net/projects/pepolinux/releases/p3211 1234567# tar xvfz epicon-XX.XX.tar.gz# cd epicon# ./configure# make# make installuninstall# make uninstall How to use Startup, no options (com1: / dev / ttys0 port, 9600bps, 8bit non-parity)123456789101112# epicon** Welcome to epicon Version-5.2 Copyright Isamu Yamauchi compiled:Feb 24 2021 ** exec shell ~! send binary files ~f send break ~b call rz,sz,sx,rx ~rz,~sz,~sx,~rx call kermit ~sk,~rk external command ~C change speed ~c exit ~. Connected /dev/ttyS0 How to exitEnter~. Communication state->to shell->コマンド入力->Return to the original communication state with exitEnter~!1234567891011 epicon wait# lsAUTHORS README configure.ac install-shCOPYING aclocal.m4 depcomp missingChangeLog autom4te.cache epicon.c patch-gkermit1.0+counter-CentOS4.2INSTALL config.h epicon.h patch-gkermit1.0+counter1.2.1Makefile.am config.h.in epicon.nr sample.scrMakefile.in config.status epicon_main.c stamp-h1NEWS configure epicon_uty.c# exitepicon run Switch settings and options available (/dev/ttyUSB0,19200bps, character delay:30ms, CR delay:50ms) In my old experience, setting this delay will not cause the config to be missed.1# epicon -d 30 -D 50 -s 19200 -l /dev/ttyUSB0 Switch settings and options available (telnet, character delay:20ms, CR delay:50ms)12345678910111213141516# epicon -d 20 -D 50 -n 192.168.0.1:23** Welcome to epicon Version-5.2 Copyright Isamu Yamauchi compiled:Feb 24 2021 ** exec shell ~! send binary files ~f send break ~b call rz,sz,sx,rx ~rz,~sz,~sx,~rx call kermit ~sk,~rk external command ~C change speed ~c exit ~.Telnet Server 1.10 All rights reserved.login : “-c” option: Specify external script mono-wireless Thermo-hygrometer AM2321 sensor, analog input, digital input/output signal from a remote location with wireless modules TWELITE and MONOSTICK Programs for remote monitoring and control It is used in pepotocsctl . The following creates a script that reads the temperature and humidity from the AM2321 sensor and starts epicon.1234567891011121314151617181920212223242526# /usr/local/bin/epicon -s 115200 -ql /dev/ttyUSBTWE-Lite -c $CMD# cat $CMD#!/bin/bashRETRY=5I2CRD="-1"while [ ${RETRY} -ne 0 ];do retry_time=`echo -en $RANDOM |cut -c 1-2` echo -en ":7888AA015C0000X\\r\\n" msleep 50 read -s -t 1 I2CRD || I2CRD="-1" echo -en ":7888AA015C03020004X\\r\\n" msleep 50 read -s -t 1 I2CRD || I2CRD="-1" msleep echo -en ":7888AA025C0006X\\r\\n" msleep 50 read -s -n 28 -t 1 I2CRD || I2CRD="-1" TMP=`echo -en ${I2CRD} | wc -c` [ ${TMP} -eq 28 ] && break RETRY=$((${RETRY} - 1)) [ ${RETRY} -eq 0 ] && break RETRY=$((${RETRY} - 1)) msleep $retry_time I2CRD="-1"done echo -en ${I2CRD} >/dev/stderr Manual excerpt 1234567891011121314151617181920212223242526272829303132333435# man epiconepicon(1) epicon Manuals NAME epicon is Easy Personal Interface Console terminal software. First I am sorry. Because my English linguistic power is very shabby, this sen‐ tence is being translated by the machine. Because of that, read it in the interpretation which it is tolerant of though it thinks that it is a little funny translation.SYNOPSIS usage: epicon [-options [argument] [-options [argument]] [-b ] <--escape cannot be used [-c external_command] [-d send_charcacter_delay(ms)] [-D send_CR_delay(ms)] [-e escape_char] [-f send_file] [-F send_file_effective_delay] [-m ] <--input echo mode [-M ] <--line mode [-l com_port] [-L output_log_file] [-n ip_address[:port]] [-p [server_port]] [-q ] <--quiet mode [-s speed] [-v ] <--show version [-x bit_length (5|6|7) parity(o|e|n) stop_bit (1|2)] [-z ] <--auto rz prohibition defaults: speed: 9600b/s (Higest of 460800) Please check the source code belowhttps://github.com/kujiranodanna/IOT-House/tree/master/raspberrypi/usr/src/epicon","link":"/2021/02/25/chobit_prog/epicon/"},{"title":"pepogpioctld","text":"What is pepogpioctld It is a daemon that quantifies the air quality based on the input / output control of gpio and the data of the environmental gas sensor BME680. When the BME680 sensor is connected, the gas resistance value is 50 counts every 5 minutes from the 2021/02/04/17:22: 23,10.2,43.0,1018.9,3436 value created by pepobme680. Based on the average value of 80%, temperature of 10%, and humidity of 10%, the following air quality: IAQ (indoor air quality) is calculated and added. IAQ is Sample 0(Good) to 500(Hazardous) Temperature(17-28℃):10% Humidity(40-70%):10% Gas(Gas±Gas_base/Gas_base):80% 12345678910111213141516[iot00f:root#] cat /www/remote-hand/tmp/.pepobme6802021/02/04/17:22:23,10.2,43.0,1018.9,3436Date/time, temperature, humidity, pressure, gas resistance[iot00f:root#] cat /www/remote-hand/tmp/.gpiodi_read_datadi[0]=1di[1]=1di[2]=1di[3]=0gpio_i2c=17:25:15,10.2,43.0,1019,3436,21Date/time, temperature, humidity, pressure, gas resistance, air quality[iot00f:root#] cat /www/remote-hand/tmp/.gpiodo_write_datado[0]=0do[1]=0do[2]=0do[3]=0 Please check the source code belowhttps://github.com/kujiranodanna/IOT-House/blob/master/raspberrypi/usr/local/bin/pepogpioctld","link":"/2021/02/04/chobit_prog/pepogpioctld/"},{"title":"Smell sensor","text":"What is pepoiaq2led Gas resistance value read from environmental gas sensor BME680 50 counts every 5 minutes Average value 80%, temperature 10%, humidity 10% Air quality calculated from: IAQ (indoor air quality) 0 to 500 The browser is good (with numerical values) It is expressed in green)~ very_bad (red) colors. You can turn on the 3-color LED from the GPIO output with pepoiaq2led. If it is always running, it can be used as an odor sensor appliance. pepoiaq2led is started via daemontools with the following command.1234# cd /www/pepolinux# ln -s /usr/local/bin/pepoiaq2led iaqled# cd /service/# ln -s /www/pepolinux/iaqled iaqled pepoiaq2led started by daemontools is stopped/started/confirmed by the following command.123# svc -d /www/pepolinux/iaqled# svc -u /www/pepolinux/iaqled# svstat /www/pepolinux/iaqled Raspberry pi’s BME680 and 3-color LED detect the smell of garlic in a tube Demo video Please check the source code belowhttps://github.com/kujiranodanna/IOT-House/blob/master/raspberrypi/usr/local/bin/pepoiaq2led","link":"/2021/02/09/chobit_prog/pepoiaq2led/"},{"title":"pepotocsctl","text":"What is GPIO wireless? What is pepotocsctl?mono-wireless The thermo-hygrometer AM2321 sensor, analog input, and digital input/output signals are separated by the wireless modules TWELITE and MONOSTICK. It is a program that can be remotely monitored and controlled from a location. pepotocsctl alone does not work, you need a separate epicon. You can operate the GPIO and AM2321 sensors of the Tocos wireless module with commands. 12# pepotocosctlusage /usr/local/bin/pepotocosctl read->chno:0-6 | write->chno:0-6 [DO:0|1|f] to 300000ms Read for 4 ports of DI (digital input) 1# pepotocsctl 0 7 The most port read of DI (digital input) 1# pepotocsctl 1 1 DO (Digital Out Pout) Light 1 to the first port 12# pepotocsctl 1 11 DO (Digital Out Pout) Write 1 to the first port and hold for 5 seconds 12# pepotocsctl 1 1 50000 I2C thermo-hygrometer AM2321 sensor read 12# pepotocsctl 52016/01/20,19:16:19,4.0℃,75.4% Analog input read 12# pepotocosctl 64080,4080,4080,4080 Light after read 12# pepotocosctl 0 07;4080,4080,4080,4080 Digital input and analog input read 12# pepotocosctl 7f;1952,4080,4080,4080 Wait for the read, DI change for the specified time 12# pepotocosctl 7 120e;4080,4080,4080,4080 Please check the source code belowhttps://github.com/kujiranodanna/IOT-House/blob/master/raspberrypi/usr/local/bin/pepotocosctl","link":"/2021/02/06/chobit_prog/pepotocsctl/"},{"title":"pepoalexado","text":"What is pepoalexado Created to turn on / off the lights with Alexa and listen to the temperature, get GPIO output and json data to the Raspberry Pi distributed in the IOT housepepoalexadousage /usr/local/bin/pepoalexado host user password [write->chno:0-17 [DO:0|1] [timer->1 to 300000ms]] or read->json_name GPIO 3 ONpepoalexado iot001.local remote hand 3 1 GPIO 3 OFFpepoalexado iot001.local remote hand 3 0 Acquire json data of I2C gas sensor BME680pepoalexado iot001.local remote hand gpio_i2c{ “date”: “08:47:11”, “temp”: “27.5℃”, “hum”: “79.7%”, “pres”: “1006hPa”, “gas”: “2055427Ω”, “iaq”: “17” } Acquire barometric pressure data of I2C gas sensor BME680pepoalexado iot001.local remote hand gpio_i2c.pres1020hPa Get low / high outdoor illuminance-> Use for judgment such as turning on the lights in the room when the outdoor illuminance becomes dark pepoalexado iot01f.local remote hand ai2di12low GPIO port 4 input of iot01f.local low-> high Execute the event registered command dio3highdio3high has registered a module camera 10 second video mail, which can activate the module camera of Raspberry Pi connected to another camera from the GPIO input event without camera connectionUsed to activate security cameras on Alexa at Practical IOT Housepepoalexado iot02f.local remote hand dio3high While a browser such as chrome is browsing https://iot01f, the browser returns voice operation and response with the registered wording.pepoalexado iot01f.local remote hand voice_req Turn off the light-> Turn off the light and executepepoalexado iot01f.local remote hand voice_req Tell me the room temperature-> The room temperature is 24.0 ℃ Alexaのhomebridge/config.json Setting Example Alexa, turn on the dining Alexa, dining Turn off the lights Alexa, security camera on Alexa, security camera off 1234567891011121314151617181920212223{{{ "platforms": [ { "platform": "Alexa", "name": "Alexa", "username": "user", "password": "pass" } ], "accessories": [ { "accessory": "CMD", "name": "dining", "on_cmd": "sudo /usr/local/bin/pepoalexado iot001.local remote hand 3 1", "off_cmd": "sudo /usr/local/bin/pepoalexado iot001.local remote hand 3 0" }, { "accessory": "CMD", "name": "security camera", "on_cmd": "sudo /usr/local/bin/pepoalexado iot03f.local remote hand dio3low", "off_cmd": "sudo /usr/local/bin/pepoalexado iot02f.local remote hand dio3high" },}}} Please check the source code belowhttps://github.com/kujiranodanna/IOT-House/blob/master/raspberrypi/usr/local/bin/pepoalexado","link":"/2021/01/30/chobit_prog/pepoalexdo/"},{"title":"cp2112_BME680","text":"What is CP2112? USB<->I2C conversion chip (Silicon Laboratories Single-Chip HID USB to SMBus Master Bridg) for Linux and Windows USB You can use 8 GPIOs and I2C from, here we are using the module board of Sunhayato’s MM-CP2122A. MM-CP2122A Selling phraseI2C connection sensor and GPIO (8 pin) can be controlled directly from a PC application without programming the microcomputer. is a difficult task, and programming requires an understanding of the HIDAPI and CP2112 interface specifications below. Hidapi Reference CP2112 Reference AN495: CP2112 Interface Specification I2C connection device verified this time BME680 hardware data When I connect to the USB of my lubuntu lts 18.04 Linux machine, the driver is loaded as shown below and the HID device is recognized. 12345# lsmod |grep cp2112hid_cp2112 24576 0hid 102400 3 hid_cp2112,hid_generic,usbhid# ll /dev/hidraw-cp2112lrwxrwxrwx 1 root root 7 4月 6 16:54 /dev/hidraw-cp2112 -> hidraw0 From here, we verified the operation of GPIO and I2C connection temperature/humidity sensor AM2320 and environmental gas sensor BME680 based on the above materials and collected information pepocp2112ctl.cThe explanation is based on the program. Install the package for development libhidapi 12# apt install libhidapi-devlibhidapi-dev libhidapi-hidraw0 libhidapi-libusb0 Get and compile the following filesFork from BoschSensortec/BME680_driver 1234567891011bme680.c bme680.h bme680_defs.h pepocp2112ctl.c# gcc -Wall -o pepocp2112ctl pepocp2112ctl.c bme680.c -lhidapi-hidraw# lltotal 144drwxr-xr-x 2 root root 140 4月 6 17:39 ./drwxr-xr-x 3 www-data www-data 840 4月 6 17:39 ../-rwxr-xr-x 1 root root 44364 4月 13 2019 bme680.c*-rwxr-xr-x 1 root root 8353 4月 13 2019 bme680.h*-rwxr-xr-x 1 root root 17134 4月 13 2019 bme680_defs.h*-rwxr-xr-x 1 root root 34644 4月 6 17:39 pepocp2112ctl*-rw-r--r-- 1 root root 30626 3月 28 16:26 pepocp2112ctl.c Programming example, SMBus Devices operation only Extract from source and explain only important parts, check the source for others. (Experience shows that GPIO needs to be operated in multiple processes, so there is a considerable amount using semaphore.) CP2112’s I2C connection device BME680 sets the I2C address, required commands, data, and byte counter in the buffer, sends it with hid_send_feature_report, and waits for a response to the command if necessary. The BME680 write sets the command(CP2112_DATA_WRITE), register address, data, and number of bytes and writes it to the device.12345678910int8_t user_i2c_write(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len){ . reg[0] = CP2112_DATA_WRITE; reg[1] = BME680_I2C_ADDR_PRIMARY<<1; reg[2] = len+1; reg[3] = reg_addr; for (int8_t i=4; i<len+4; i++) reg[i] = reg_data[i-4]; rslt = hid_send_feature_report(hd, reg, len+4); Dump of buffer etc. during debugging12345user_i2c_write() dev_id: ec reg_addr: e0 len: 1user_i2c_write()1 rslt: 5 len: 1reg dump start0:14 1:ec 2:02 3:e0 4:b6reg dump end The BME680 read first sends the register address with a write command.Next, send the I2C address read request command(CP2112_DATA_READ_REQ),Wait for Polling, status confirmation(CP2112_DATA_READ_RESPONS),until the data is ready(CP2112_DATA_READ_FORCE_SEND),and then read the data from the device.12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061int8_t user_i2c_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len){ . reg[0] = CP2112_DATA_WRITE; reg[1] = BME680_I2C_ADDR_PRIMARY<<1; reg[2] = 1; reg[3] = reg_addr; rslt = hid_send_feature_report(hd, reg, 4); . user_delay_ms(HID_WAIT); reg[0] = CP2112_DATA_READ_REQ; reg[1] = BME680_I2C_ADDR_PRIMARY<<1; reg[2] = 0x00; // reads length_high reg[3] = len; // reads length_low rslt = hid_send_feature_report(hd, reg, 4); . user_delay_ms(HID_WAIT); while (retry_cnt < 3) {/* SMBus Polling */ reg[0] = CP2112_DATA_READ_FORCE_SEND; reg[1] = 0x00; // reads length_high reg[2] = len; // reads length_low rslt = hid_send_feature_report(hd, reg, 3); . user_delay_ms(HID_WAIT); rslt = hid_read_timeout(hd, buf_in, len+3, timeout); ./* buf_in[0]:hid_report ID->0x13:CP2112_DATA_READ_RESPONS buf_in[1]:hid_status 0x00->Idle ,x01->Busy ,x02->Complete ,buf_in[2]:hid_read_length buf_in[3]-:Following_BME680_Read_Data*/ if (buf_in[0] == CP2112_DATA_READ_RESPONS) { if (buf_in[1] == 0x00 || buf_in[1] == 0x02 || buf_in[1] == 0x03) . break; retry_cnt++; // Busy or Idle or Other user_delay_ms(HID_WAIT); continue; } if (buf_in[0] == CP2112_TRANSFER_STATUS_RESP) { . user_delay_ms(HID_WAIT); retry_cnt++; continue; } } . if(buf_in[2] > 0 && rslt > 3 && buf_in[2] < rslt) { int8_t j = buf_in[2]; for (int8_t i=0; i < j; i++) { reg_data[i] = buf_in[i+3]; } return 0; } Dump of buffer etc. during debugging1234567891011user_i2c_read dev_id: ec reg_addr: d0 reg_data: 04 len: 1user_i2c_read()hid_read_timeout rslt:4 retry_cnt:0buf_in dump start0:13 1:02 2:01 3:61buf_in dump enduser_i2c_read dev_id: ec reg_addr: 89 reg_data: 04 len: 25user_i2c_read()hid_read_timeout rslt:28 retry_cnt:0buf_in dump start0:13 1:02 2:19 3:40 4:a3 5:66 6:03 7:2f 8:80 9:8e 10:c9 11:d6 12:58 13:ff 14:de 15:19 16:cf 17:ff 18:2f 19:1e 20:00 21:00 22:1a 23:f3 24:e7 25:f6 26:1e 27:02buf_in dump end Please check the source code belowhttps://github.com/kujiranodanna/BME680_driver","link":"/2021/04/13/cp2112/"},{"title":"IOT-House_old_pc","text":"What is IOT-House_old_pc? It’s old and it’s a home and a thing with a laptop using Windows. IOT-House_old_pc is a port of IOT-House from Raspberry Pi to Ubuntu 18.04 LTS. Moist Sunhayato’s MM-CP2112A to GPIO with heavy environmental gas, BME680 and temperature sensor AM2320. IOT-House_old_pc is good and common because it is used. For the operating environment, enter a notebook with a CPU of 1GHz and a memory of about 1GB. raspberry pi zero W, the power consumption of the laptop (25W dose) is. Hardware Please prepare the flash memory with the following capacity.12345678910111213fdisk /dev/sdbWelcome to fdisk (util-linux 2.29.2).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): pDisk /dev/mmcblk0: 7.3 GiB, 7820279808 bytes, 15273984 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dosDisk identifier: 0x15ae16d5 Install Download the image from the URLIOT-House_old_pc_xx.7z Unzip the downloaded file, IOT-House_old_pc_xx.7z, and write IOT-House_old_pc_xx.img to flash memory, for example dd command1dd if=IOT-House_old_pc_xx.img of=/dev/sdb bs=100M After installing the flash memory and MM-CP2112A to the USB of the laptop computer, turn on the power, it may take about 5 minutes to start up. Setting When the login screen appears, log in with user: remote, password: hand Set the network settings according to each environment. By default, the preferred LAN and host name iot000 From another PC, log in with user: remote, password: hand at http://iot000.local Set when the Control panel is displayed Once the network settings are complete, you can shorten the startup time without the following command GUI. 1sudo systemctl set-default multi-user.target The setting method is the same as IOT-House of raspberry pi","link":"/2021/06/20/iot-house_old_pc/"}],"tags":[{"name":"About this","slug":"About-this","link":"/tags/About-this/"},{"name":"Security camera application","slug":"Security-camera-application","link":"/tags/Security-camera-application/"},{"name":"Automation settings","slug":"Automation-settings","link":"/tags/Automation-settings/"},{"name":"Environmental gas sensor BME680","slug":"Environmental-gas-sensor-BME680","link":"/tags/Environmental-gas-sensor-BME680/"},{"name":"basic setting","slug":"basic-setting","link":"/tags/basic-setting/"},{"name":"gmail settings","slug":"gmail-settings","link":"/tags/gmail-settings/"},{"name":"Input settings","slug":"Input-settings","link":"/tags/Input-settings/"},{"name":"I/O event settings","slug":"I-O-event-settings","link":"/tags/I-O-event-settings/"},{"name":"Output settings","slug":"Output-settings","link":"/tags/Output-settings/"},{"name":"illuminometer of one dollar calculator","slug":"illuminometer-of-one-dollar-calculator","link":"/tags/illuminometer-of-one-dollar-calculator/"},{"name":"Learning infrared remote control","slug":"Learning-infrared-remote-control","link":"/tags/Learning-infrared-remote-control/"},{"name":"Security camera","slug":"Security-camera","link":"/tags/Security-camera/"},{"name":"hardware","slug":"hardware","link":"/tags/hardware/"},{"name":"Installation","slug":"Installation","link":"/tags/Installation/"},{"name":"Save settings","slug":"Save-settings","link":"/tags/Save-settings/"},{"name":"serial communication software","slug":"serial-communication-software","link":"/tags/serial-communication-software/"},{"name":"Smell sensor","slug":"Smell-sensor","link":"/tags/Smell-sensor/"},{"name":"Wireless GPIO","slug":"Wireless-GPIO","link":"/tags/Wireless-GPIO/"},{"name":"cp2112andBME680","slug":"cp2112andBME680","link":"/tags/cp2112andBME680/"},{"name":"iot-house_old_pc","slug":"iot-house-old-pc","link":"/tags/iot-house-old-pc/"}],"categories":[{"name":"source","slug":"source","link":"/categories/source/"},{"name":"epicon","slug":"source/epicon","link":"/categories/source/epicon/"},{"name":"pepogpioctld","slug":"source/pepogpioctld","link":"/categories/source/pepogpioctld/"},{"name":"pepoiaq2led","slug":"source/pepoiaq2led","link":"/categories/source/pepoiaq2led/"},{"name":"pepotocsctl","slug":"source/pepotocsctl","link":"/categories/source/pepotocsctl/"},{"name":"pepoalexado","slug":"source/pepoalexado","link":"/categories/source/pepoalexado/"}]}