Pol Isidor

Members
  • Content Count

    20
  • Joined

  • Last visited

About Pol Isidor

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. then thats it..we need to wait till develeopers do not fix it Sent from my MI 6 using Tapatalk
  2. Hence. armbian with kernel v4.x isn't reliable absolutely.. Sent from my MI 6 using Tapatalk
  3. Thx for replay..but I need to disappointed you. I have even the same board what u ordered OrangePI +2E, and I was with same logic that maybe it is related with the OrangePI PC model, but no. It happening the same, totally. So you can jump over that step and try right now with newest image. I unforunately have not my orange next to me to try the newest (with compaling) image, but I will do in next 2 week.
  4. I have totally same problem.. I have connected 2 card reader to orange PI PC and maximum in 48-72h I can expirience the same problem. Can not access PI over ssh, black screen on HDMI out. I tried (about 2months ago) to compile myself the actual version of armbian with tutorial and script what I found here on this forum, but I expirience the same issue. My question is: Is this happening same with a newest kernel and relase? Is thre any fix for this?
  5. Thx mate..this is the right answer on question!
  6. Thx for quick answer, and sorry for late replay.. Yes it seams to be the solution if I disable next repos: deb http://httpredir.debian.org/debian jessie-updates main contrib non-free deb http://httpredir.debian.org/debian jessie-backports main contrib non-free
  7. Hello.. I'm using Armbian v5.71 on Orange Pi Plus 2E with kernel: version 3.4.113-sun8i. I didn't touch the /etc/apt/sources.list file This is ~third day that I can not do the apt-get update without error. The output is: root@orangepiplus2e:~# apt-get update Hit http://security.debian.org jessie/updates InRelease Hit http://apt.armbian.com jessie InRelease Get:1 http://security.debian.org jessie/updates/main armhf Packages [636 kB] Get:2 http://apt.armbian.com jessie/main armhf Packages [413 kB] Hit http://security.debian.org jessie/updates/contrib armhf Packages Hit http://security.debian.org jessie/updates/non-free armhf Packages Get:3 http://apt.armbian.com jessie/jessie-utils armhf Packages [8,513 B] Get:4 http://apt.armbian.com jessie/jessie-desktop armhf Packages [21.9 kB] Ign http://httpredir.debian.org jessie InRelease Ign http://httpredir.debian.org jessie-updates InRelease Ign http://httpredir.debian.org jessie-backports InRelease Hit http://httpredir.debian.org jessie Release.gpg Ign http://httpredir.debian.org jessie-updates Release.gpg Ign http://httpredir.debian.org jessie-backports Release.gpg Hit http://httpredir.debian.org jessie Release Ign http://httpredir.debian.org jessie-updates Release Ign http://httpredir.debian.org jessie-backports Release Ign http://httpredir.debian.org jessie-updates/main armhf Packages/DiffIndex Ign http://httpredir.debian.org jessie-updates/contrib armhf Packages/DiffIndex Ign http://httpredir.debian.org jessie-updates/non-free armhf Packages/DiffIndex Ign http://httpredir.debian.org jessie-backports/main armhf Packages/DiffIndex Ign http://httpredir.debian.org jessie-backports/contrib armhf Packages/DiffIndex Ign http://httpredir.debian.org jessie-backports/non-free armhf Packages/DiffIndex Hit http://httpredir.debian.org jessie/main armhf Packages Hit http://httpredir.debian.org jessie/contrib armhf Packages Hit http://httpredir.debian.org jessie/non-free armhf Packages Err http://httpredir.debian.org jessie-updates/main armhf Packages 404 Not Found [IP: 151.101.240.204 80] Err http://httpredir.debian.org jessie-updates/contrib armhf Packages 404 Not Found [IP: 151.101.240.204 80] Err http://httpredir.debian.org jessie-updates/non-free armhf Packages 404 Not Found [IP: 151.101.240.204 80] Err http://httpredir.debian.org jessie-backports/main armhf Packages 404 Not Found [IP: 151.101.240.204 80] Err http://httpredir.debian.org jessie-backports/contrib armhf Packages 404 Not Found [IP: 151.101.240.204 80] Err http://httpredir.debian.org jessie-backports/non-free armhf Packages 404 Not Found [IP: 151.101.240.204 80] Fetched 443 kB in 15s (28.4 kB/s) W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/main/binary-armhf/Packages 404 Not Found [IP: 151.101.240.204 80] W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/contrib/binary-armhf/Packages 404 Not Found [IP: 151.101.240.204 80] W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/non-free/binary-armhf/Packages 404 Not Found [IP: 151.101.240.204 80] W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-backports/main/binary-armhf/Packages 404 Not Found [IP: 151.101.240.204 80] W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-backports/contrib/binary-armhf/Packages 404 Not Found [IP: 151.101.240.204 80] W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-backports/non-free/binary-armhf/Packages 404 Not Found [IP: 151.101.240.204 80] E: Some index files failed to download. They have been ignored, or old ones used instead. I tried even on my Orange PI PC with same 3.4.xxx from another country and the result is same. If I put in web browser the mentioned IP address I got: Fastly error: unknown domain: 151.101.240.204. Please check that this domain has been added to a service. Details: cache-mxp19830-MXP Fastly error: unknown domain: 151.101.240.204. Please check that this domain has been added to a service. Details: cache-mxp19830-MXP This is clean install of armbian, so my question is how can I solve it. Thx
  8. Neither of above method didn't work for me. But your worked! Hence, thank you!
  9. Ok, I found the solution.. I understand the basic of python so I changed a code: dht22.py import time from pyA20.gpio import gpio from pyA20.gpio import port class DHT22Result: 'DHT22 sensor result returned by DHT22.read() method' ERR_NO_ERROR = 0 ERR_MISSING_DATA = 1 ERR_CRC = 2 error_code = ERR_NO_ERROR temperature = -1 humidity = -1 # tmin = -1 def __init__(self, error_code, temperature, humidity): self.error_code = error_code self.temperature = temperature self.humidity = humidity # self.tmin = tmin def is_valid(self): return self.error_code == DHT22Result.ERR_NO_ERROR class DHT22: 'DHT22 sensor reader class for Raspberry' __pin = 0 def __init__(self, pin): self.__pin = pin def read(self): gpio.setcfg(self.__pin, gpio.OUTPUT) # send initial high self.__send_and_sleep(gpio.HIGH, 0.05) # pull down to low self.__send_and_sleep(gpio.LOW, 0.02) # change to input using pull up #gpio.setcfg(self.__pin, gpio.INPUT, gpio.PULLUP) gpio.setcfg(self.__pin, gpio.INPUT) gpio.pullup(self.__pin, gpio.PULLUP) # collect data into an array data = self.__collect_input() # parse lengths of all data pull up periods pull_up_lengths = self.__parse_data_pull_up_lengths(data) # if bit count mismatch, return error (4 byte data + 1 byte checksum) if len(pull_up_lengths) != 40: return DHT22Result(DHT22Result.ERR_MISSING_DATA, 0, 0) # calculate bits from lengths of the pull up periods bits = self.__calculate_bits(pull_up_lengths) # we have the bits, calculate bytes the_bytes = self.__bits_to_bytes(bits) # calculate checksum and check checksum = self.__calculate_checksum(the_bytes) if the_bytes[4] != checksum: return DHT22Result(DHT22Result.ERR_CRC, 0, 0) c = (float)(((the_bytes[2]&0x7F)<< 8)+the_bytes[3])/10; # ok, we have valid data, return it if ( c > 125 ): c = the_bytes[2]; if (the_bytes[2] & 0x80): c = -c; return DHT22Result(DHT22Result.ERR_NO_ERROR, c ,((the_bytes[0]<<8)+the_bytes[1])/10.00) def __send_and_sleep(self, output, sleep): gpio.output(self.__pin, output) time.sleep(sleep) def __collect_input(self): # collect the data while unchanged found unchanged_count = 0 # this is used to determine where is the end of the data max_unchanged_count = 100 last = -1 data = [] while True: current = gpio.input(self.__pin) data.append(current) if last != current: unchanged_count = 0 last = current else: unchanged_count += 1 if unchanged_count > max_unchanged_count: break return data def __parse_data_pull_up_lengths(self, data): STATE_INIT_PULL_DOWN = 1 STATE_INIT_PULL_UP = 2 STATE_DATA_FIRST_PULL_DOWN = 3 STATE_DATA_PULL_UP = 4 STATE_DATA_PULL_DOWN = 5 state = STATE_INIT_PULL_DOWN lengths = [] # will contain the lengths of data pull up periods current_length = 0 # will contain the length of the previous period for i in range(len(data)): current = data[i] current_length += 1 if state == STATE_INIT_PULL_DOWN: if current == gpio.LOW: # ok, we got the initial pull down state = STATE_INIT_PULL_UP continue else: continue if state == STATE_INIT_PULL_UP: if current == gpio.HIGH: # ok, we got the initial pull up state = STATE_DATA_FIRST_PULL_DOWN continue else: continue if state == STATE_DATA_FIRST_PULL_DOWN: if current == gpio.LOW: # we have the initial pull down, the next will be the data pull up state = STATE_DATA_PULL_UP continue else: continue if state == STATE_DATA_PULL_UP: if current == gpio.HIGH: # data pulled up, the length of this pull up will determine whether it is 0 or 1 current_length = 0 state = STATE_DATA_PULL_DOWN continue else: continue if state == STATE_DATA_PULL_DOWN: if current == gpio.LOW: # pulled down, we store the length of the previous pull up period lengths.append(current_length) state = STATE_DATA_PULL_UP continue else: continue return lengths def __calculate_bits(self, pull_up_lengths): # find shortest and longest period shortest_pull_up = 1000 longest_pull_up = 0 for i in range(0, len(pull_up_lengths)): length = pull_up_lengths[i] if length < shortest_pull_up: shortest_pull_up = length if length > longest_pull_up: longest_pull_up = length # use the halfway to determine whether the period it is long or short halfway = shortest_pull_up + (longest_pull_up - shortest_pull_up) / 2 bits = [] for i in range(0, len(pull_up_lengths)): bit = False if pull_up_lengths[i] > halfway: bit = True bits.append(bit) return bits def __bits_to_bytes(self, bits): the_bytes = [] byte = 0 for i in range(0, len(bits)): byte = byte << 1 if (bits[i]): byte = byte | 1 else: byte = byte | 0 if ((i + 1) % 8 == 0): the_bytes.append(byte) byte = 0 return the_bytes def __calculate_checksum(self, the_bytes): return the_bytes[0] + the_bytes[1] + the_bytes[2] + the_bytes[3] & 255 dht22_main.py from pyA20.gpio import gpio from pyA20.gpio import port from time import gmtime, strftime import paho.mqtt.client as mqtt import dht22 import time import datetime import os PIN2 = port.PA6 gpio.init() n=150 #after every 150 (~10 minutes) load (connect to thingspeak) again! i=0 channelId = "xxxxx" # Put your channel ID here,i.e.. the number from the URL, https://thingspeak.com/channels/285697 apiKey = "xxxxxxxxxxxxxxx" # Put the API key here (the Write API Key from the API Keys tab in ThingSpeak) client = mqtt.Client() client.connect("mqtt.thingspeak.com",1883,60) instance = dht22.DHT22(pin=PIN2) os.system('clear') while True: result = instance.read() if result.is_valid(): i=i+1 print("\033[37;1mLast valid input: \033[0m" + "\033[33;1m" + str(strftime("%d.%m.%Y %H:%M:%S", gmtime())) + "\033[0m") print("\033[37;1mTemperature: \033[1;31m%.2f C\033[0m" % result.temperature) print("\033[37;1mHumidity: \033[32;1m%.2f %%\033[0m\n" % result.humidity) if i == n-1: print 'Now setting value i to zero\nLoading libary again' i=0 client = mqtt.Client() client.connect("mqtt.thingspeak.com",1883,60) client.publish("channels/%s/publish/%s" % (channelId,apiKey), "field1=" + str(result.temperature) + "&field2=" + str(result.humidity)) else: client.publish("channels/%s/publish/%s" % (channelId,apiKey), "field1=" + str(result.temperature) + "&field2=" + str(result.humidity)) else: time.sleep(4) Scrip for checking if proccess stop. You need to put in crontab (at me every 5miutes) chk_dht22_script.sh #!/bin/bash PID_OF_APP="/run/pidfile_dht22.pid" PID_OF_PROCCESS=`ps -aux|grep dht22_main|grep -v grep|awk -F" " '{print $2}'` PID_OF_PROCCESS=( $PID_OF_PROCCESS ) NUMBER_OF_OCCURENCE=`echo ${#PID_OF_PROCCESS[@]}` #echo $NUMBER_OF_OCCURENCE if [[ "$NUMBER_OF_OCCURENCE" == 0 ]];then echo -e "Proccess isn't started..\nNow process dht22_main.py and creating PID file..." python /emu/script/dht22_* & disown & echo $! > /run/pidfile_dht22.pid exit fi if [[ "$NUMBER_OF_OCCURENCE" > 1 ]];then echo -e "Process dht22_main.py is started more than 1x" echo -e "Now killing all proccess one by one" PID_OF_PROCCESS=`ps -aux|grep dht22_main|grep -v grep|awk -F" " '{print $2}'` kill $PID_OF_PROCCESS rm -fr $PID_OF_APP echo -e "Starting process dht22_main.py and creating PID file..." python /emu/script/dht22_* & echo $! > /run/pidfile_dht22.pid fi
  10. Again me with problem.. I changed the sensor to DHT22 2303 because I wanted bigger precision.. Now I found a code dht22.py: The only difference if I compare with dht11.py in code is: return DHT11Result(DHT11Result.ERR_NO_ERROR, the_bytes[2], the_bytes[0]) and in dht22.py is: return DHT22Result(DHT22Result.ERR_NO_ERROR, (((the_bytes[2] & 0x7F)<<8)+the_bytes[3])/10.00, ((the_bytes[0]<<8)+the_bytes[1])/10.00) Of course it is renamed to DHT 22 Everything working nice but it do not showing the negative value of temperate.. It is like I using an absolute value of temperature.. If I run the code what is typed i C language the I see nicely the negative value: root@orangepipc:~# ./dht DHT22 temperature/humidity test Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.7 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) ^C root@orangepipc:~# ^C root@orangepipc:~# ./dht DHT22 temperature/humidity test Humidity = 66.8 % Temperature = -1.0 *C (30.2 *F) ^C root@orangepipc:~# ./dht DHT22 temperature/humidity test Humidity = 66.9 % Temperature = -1.0 *C (30.2 *F) Humidity = 67.0 % Temperature = -0.4 *C (31.3 *F) Humidity = 66.9 % Temperature = -0.4 *C (31.3 *F) Where can be the problem? Thx
  11. Yes yes, I agree with u... I just post the "working solution". I will do the cleaning, and I'm totally understand what are u talking about.. Anyway, thx for help!
  12. @chwe Thx mate..this is the solution.. At the end it looks like this: from pyA20.gpio import gpio from pyA20.gpio import port import paho.mqtt.client as mqtt #import dht11 import dht11 import time import datetime PIN2 = port.PA6 gpio.init() channelId = "xxxxxxx" # Put your channel ID here,i.e.. the number from the URL, https://thingspeak.com/channels/285697 apiKey = "xxxxxxxxxx" # Put the API key here (the Write API Key from the API Keys tab in ThingSpeak) client = mqtt.Client() client.connect("mqtt.thingspeak.com",1883,60) instance = dht11.DHT11(pin=PIN2) gpio.init() # read data using GPIO7 #instance = dht11.DHT11(pin=PIN26) while True: result = instance.read() if result.is_valid(): client.publish("channels/%s/publish/%s" % (channelId,apiKey), "field1=" + str(result.temperature) + "&field2=" + str(result.humidity)) time.sleep(5)
  13. Can someone help me, why I can not compile pyGPIO? Im using Orange PI PC ans HDW with: Armbian_5.32_Orangepipc_Debian_jessie_default_3.4.113
  14. Sorry now I see, that I can not install: error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1 I heve few errors while I compiling: Any idea why?