• Content Count

  • Joined

  • Last visited

About Matthai

  • Rank
    Advanced Member

Recent Profile Visitors

419 profile views
  1. OK, just an information for others, how I solved this: 1. Install Armbian (on OrangePi Zero H2+) 2. Install Python: sudo apt install python python-pip python-setuptools python-dev 3. Install pyA20: sudo pip install pyA20 4. Install GPIO: git clone cd orangepi_zero_gpio/ sudo python install cd .. 5. Create new Python app: nano With the content: #!/usr/bin/env python import os import sys if not os.getegid() == 0: sys.exit('Script must be run as root') from time import sleep from pyA20.gpio import gpio from pyA20.gpio import port button = port.PA10 gpio.init() gpio.setcfg(button, gpio.INPUT) """Enable pullup resistor""" gpio.pullup(button, gpio.PULLUP) #gpio.pullup(button, gpio.PULLDOWN) # Optionally you can use pull-down resistor try: print ("Press CTRL+C to exit") while True: state = gpio.input(button) # Read button state if (state == 1): print ("The door is OPENED.") else: print ("The door is CLOSED.") sleep(0.5) except KeyboardInterrupt: print ("Goodbye.") 6. Connect reed switch: - one wire to GND - the other wire to GPIO 26 (PA10) 7. Run the app: sudo python The output: The door is OPENED. The door is OPENED. The door is OPENED. The door is OPENED. The door is OPENED. The door is CLOSED. The door is CLOSED. The door is CLOSED. The door is CLOSED. The door is OPENED. The door is OPENED. Now... the web app. But this is another story.
  2. OK, I see. So I connect reed switch to GND and GPIO pin and enable internal resistor: gpio.setcfg(button, gpio.INPUT) gpio.pullup(button, gpio.PULLUP) # enable internal pullup resistor I am confident, but what is happening when device is booting? Is it possible, that device goes to some weird state and GPIO pin set to output during device init? By low value you mean 1k, more, less?
  3. OK, I see. I just got confused by gpio1p40 notation. Thanks for clarification. I assume I can connect switch to 3.3V or GND, it will just read the different state (once open, the other closed). But what about resistor? 4.7 kOhm together with internal pullup resistor seems OK? I mean, it is not necessary, but if GPIO pin is accidentally set to output, then I assume it will protect the board from frying? Or I am wrong?
  4. Sorry, I do not understand. As I understand, this: button = connector.gpio1p40 #CHOW This means, that button is connected to gpio1p40. In your link, I cannot find which pin that would be. I mean physically, where to connect reed switch, on which pins exactly?
  5. I would like to connect reed switch to OrangePi Zero with H2 processor. Can I use this? Under examples, there are two examples I think I could use: - - I have two questions. 1. Where is the pinout? has this code: led = connector.gpio0p0 # This is the same as port.PH2 button = connector.gpio3p40 has this code: led = connector.gpio1p38 # This is the same as port.PH2 button = connector.gpio1p40 #CHOW Which pins are which, where to get the picture of GPIO pins? (And why LED's connector ID's are different in the above examples)? Here is one example of pinouts, but the names are different: 2. Where to connect reed switch? One is one of the GPIO pins, and other? GND, 5V, 3.3V? And - I assume I do not to use a resistor? Or I am wrong?
  6. Thanks for advices. BTW, is there any search engine among these devices? I mean among development boards. That you are able to select how many USB's does it have, does it have HDMI, eMMC,...
  7. Basically a 5V device (powered by micro USB) would be great. I want it to be small and cheap, I intend to use it for a little bit special router/firewall (so it should run Linux). I do not need great network speed (100Mbps is enough). There is also no need for very high performance. No HDMI. USB I need for Yubikey and maybe to connect some other device like printer, webcam...
  8. Hi, I am looking for a device, which has the following hardware: - 2x wifi adapter - 2x ethernet adapter - CSI connector for camera - 2x USB port or 1x USB and 1x USB-C port I know it would be very hard to find such a device, but an option would be to use one USB port and WiFi dongle instead second build-in WiFi and another USB to connect ethernet dogle into it. And for USB-C I can use use an USB-C-to-USB adapter... So at least I would like to find a device with: - 1x wifi adapter - 1x ethernet adapter - CSI connector for camera - 2x or 3x USB port Any ideas?
  9. The idea is to have WifiAP, which connects to VPN. Software on a SD card would be generic, but VPN keys/paswords would be written on a SPI flash.
  10. OrangePi Zero has (according to specifications) 2Mb SPI flash. Sorry for my newbie question, but how is it possible to write there some file and read it later? Or at least some data (string)?
  11. I have OrangePi Zero 512 with Armbian Bionic. I hav econnected LED diode to GPIO PA12 pin. When I (re)boot the device, LED is automatically on. I have to switch it off then manually (with Python script). Is there any config file in Armbian to define which GPIO ports should be switched off?
  12. In this file, you mean in /etc/dnsmasq.conf?
  13. Of course, I am doing IP forwarding: sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward" And this: sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
  14. Well, yes, that was my mistake, I corrected it, but it is still not working. Anyway, it seems I pasted wrong config here. My /etc/dnsmasq.conf is: # Configuration file for dnsmasq. port=53 domain-needed bogus-priv resolv-file=/etc/dnsmasq/resolv.conf no-resolv server= server= interface=wlan0 listen-address= bind-interfaces addn-hosts=/etc/dnsmasq/hosts.conf dhcp-range=,,12h dhcp-leasefile=/var/lib/misc/dnsmasq.leases domain=orangepi.wifi local=/orangepi.wifi/
  15. I am trying to set up Wifi AP on OrangePi Zero board. Basically, I install and configure hostapd and dnsmasq and create a script, which does the following (it is run as sudo): nmcli radio wifi off rfkill unblock wlan ifconfig wlan0 netmask broadcast service dnsmasq restart /usr/sbin/hostapd /etc/hostapd/hostapd.conf This is the /etc/dnsmasq.conf: port=53 domain-needed bogus-priv resolv-file=/etc/dnsmasq/resolv.conf interface=wlan0 listen-address= bind-interfaces addn-hosts=/etc/dnsmasq/hosts.conf dhcp-range=,,12h dhcp-leasefile=/var/lib/misc/dnsmasq.leases domain=orangepi.wifi no-resolve server server local=/orangepi.wifi/ I also have in /etc/dnsmasq/resolv.conf: nameserver And in /etc/dnsmasq/hosts.conf: orangepi.wifi www.orangepi.wifi So... I run the script, SSID appears, and I can connect to the OrangePi Access Point. I get the IP address (within DHCP range), from OrangePiI can ping the connected device, and from the device I can ping OrangePi (ping From the device I can ping, but if I try to ping, DNS resolving does not work. (From OrangePi internet is working good). I assumed ther eis some problem with Dnsmasq, so I installed udhcpd instead, but the problem is the same. Any idea?