JRD McLAREN

  • Posts

    18
  • Joined

  • Last visited

Recent Profile Visitors

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

JRD McLAREN's Achievements

  1. OK .. but, if you can use another board ... (OPIZero Plus or OPIZero Plus2 or anything else) this is useful ...
  2. Final version..... Anybody can use their own commands for start-stop processes or for bring up-down interfaces... #!/usr/bin/env python3 # Set your pins button = (5) led = (26) #Set your commands cmd_dnsmasq_stop = "systemctl stop dnsmasq.service" cmd_dnsmasq_start = "systemctl start dnsmasq.service" cmd_wpa_supplicant_stop = "systemctl stop wpa_supplicant.service" cmd_wpa_supplicant_start = "systemctl start wpa_supplicant.service" cmd_wifi_off = "nmcli con down WiFi" cmd_wifi_on = "nmcli con up WiFi" cmd_hostap_on = "hostapd /etc/hostapd.conf -B" cmd_hostap_off = "killall hostapd" cmd_bridge_on = "nmcli con up Bridge" cmd_bridge_off = "nmcli con down Bridge" cmd_dnsmasq_ap_on = "dnsmasq -C /etc/dnsmasq_ap.conf" cmd_dnsmasq_ap_off = "killall dnsmasq" # Main script import os import sys import OPi.GPIO as GPIO import time client = 0 ap = 1 # Placeholder variable GPIO.setwarnings(False) # Ignore warning for now GPIO.setmode(GPIO.BOARD) GPIO.setup(led, GPIO.OUT, initial=GPIO.LOW, pull_up_down=GPIO.PUD_DOWN) GPIO.setup(button, GPIO.IN, initial=GPIO.LOW, pull_up_down=GPIO.PUD_DOWN) state = client while True: GPIO.wait_for_edge(button, GPIO.RISING) # This is a function os.system(cmd_wifi_off) time.sleep(3) os.system(cmd_dnsmasq_stop) time.sleep(5) os.system(cmd_wpa_supplicant_stop) time.sleep(5) os.system(cmd_bridge_on) time.sleep(15) os.system(cmd_dnsmasq_ap_on) time.sleep(10) os.system(cmd_hostap_on) time.sleep(5) GPIO.output(led, GPIO.HIGH) print("AP mode is started") state = ap time.sleep(5) if state == ap: GPIO.wait_for_edge(button, GPIO.RISING) # This is a function os.system(cmd_hostap_off) time.sleep(3) os.system(cmd_dnsmasq_ap_off) time.sleep(3) os.system(cmd_bridge_off) time.sleep(5) os.system(cmd_wpa_supplicant_start) time.sleep(5) os.system(cmd_dnsmasq_start) time.sleep(7) os.system(cmd_wifi_on) time.sleep(3) GPIO.output(led, GPIO.LOW) print("Client mode is strted") state = client time.sleep(5)
  3. Thanks for answer Igor .. I'm wrote my own script in python, moved to OPi Zero with poor XR819 .. Better OPi Zero Plus H5 with RTL8189FTV wifi module was burned ... and H5 board does notwork properly with WiringPO library at this moment .. see:
  4. So ... for some time ... Here is my python script, for switching one wifi intreface ... It is first "one-way" version ... The OPi.GPIO library for python is needed. https://opi-gpio.readthedocs.io/en/latest/install.html #!/usr/bin/env python import os #import sys import OPi.GPIO as GPIO import time # Set your pins button = (7) led = (26) cmd_dnsmasq_stop = "systemctl stop dnsmasq.service" cmd_dnsmasq_start = "systemctl start dnsmasq.service" cmd_wpa_supplicant_stop = "systemctl stop wpa_supplicant.service" cmd_wpa_supplicant_start = "systemctl start wpa_supplicant.service" cmd_wifi_off = "nmcli con down WiFi" cmd_wifi_on = "nmcli con up WiFi" cmd_hostap = "hostapd /etc/hostapd.conf -B" cmd_bridge_on = "nmcli con up Bridge" cmd_bridge_off = "nmcli con down Bridge" cmd_dnsmasq_ap = "dnsmasq -C /etc/dnsmasq_ap.conf" # Placeholder variable GPIO.setmode(GPIO.BOARD) GPIO.setup(led, GPIO.OUT, initial=GPIO.LOW, pull_up_down=GPIO.PUD_DOWN) GPIO.setup(button, GPIO.IN, initial=GPIO.LOW, pull_up_down=GPIO.PUD_DOWN) #def my_callback(): # print('This is a edge event callback function!') # print('Edge detected on channel %s'%button) # print('This is run in a different thread to your main program') #GPIO.add_event_detect(button, GPIO.RISING, callback=my_callback, bouncetime=200) #GPIO.add_event_callback(button, my_callback) GPIO.wait_for_edge(button, GPIO.RISING) # add rising edge detection on a channel print('Button pressed') print('Wifi Off') os.system(cmd_wifi_off) time.sleep(2) print('Stop DNSMASQ') os.system(cmd_dnsmasq_stop) time.sleep(5) print('Stop WPA Supplicant') os.system(cmd_wpa_supplicant_stop) time.sleep(2) print('Start Bridge') os.system(cmd_bridge_on) time.sleep(2) print('Start DNSMASQ AP') os.system(cmd_dnsmasq_ap) time.sleep(5) print('Start HostAP') os.system(cmd_hostap) time.sleep(5) GPIO.output(led, GPIO.HIGH) #GPIO.cleanup()
  5. Nice script, but it's not working on my OPiZeroPlus2 H5 The problem is outdated WiringPO library - from zhaolei More updated library from Orange http://www.orangepi.org/Docs/WiringPi.html can be compiled on actual armbian gpio recognize opizeroplus2 board, but pushbuttons script frozen hole board ... Is any project on sf or github for these boards and GPIO contol ..??
  6. Hello, I'm try to setup my OPiZero as mediaplyer, and I need to use it sometimes as WiFi Client - Managed mode and sometimes as WiFi AP - Master mode. Scenario 1 Work in "dual mode", I mean, when my wifi network within reach, then OPiZ start as "client", and connect to my preferred wifi network when wifi network not in range, it start as AP+DHCP (hostapd and dnsmasq) Scenario 2 Switched mode, Make any push button on gpio, and then make scripts "to do the job" .. disconnect from wifi, stop wpa_supplicant, run hostapd an dnsmasq. Has anybody something like "scenrio1" or "scenario2" .. ?? (or my ideas are totally bad ... )
  7. Hello, now I have some time to spend it with OPI Zero Plus2 H5 Try to download and install Armbian_5.90_Orangepizeroplus2-h5_Ubuntu_bionic_next_4.19.57, update it, and try to do something (bluetooth player) with this. But, no working BT device after fresh install. So, I must try to do something with this. (one more time) Now I have working script, see attach. Can anybody try this patch please ..? Thanks brcm43438-patch
  8. Heloo.. I have some time past days, to try to work Bluetooth AP6212 adapter on my OPIZeroPlus H5 version ... but, no fun. Have ARMBIAN 5.73 stable Ubuntu 18.04.2 LTS 4.19.38-sunxi64 and try Debian version also. Today I try to look on DTB files, some wiring diagrams etc ... read some posts on this forum, and try it step-by-step ... Now I have working BT on this version OPiZero2 H5 .. and make these modification to work it: Edit /etc/init.d/ap6212-bluetooth file: .. No overlay is needed in armbian.txt for uart1 .. ..so I just remove it ..
  9. Yes, you're right. I know it. But, I need to access ssh and it look's as a common systemd package problem "on Ubuntu's side"
  10. So .. I have the same problem .. after update. http://ix.io/1zim Fast fix to run sshd - edit /etc/ssh/sshd_config UsePrivilegeSeparation no Board / system is OpiZero H2+ ARMBIAN 5.70 stable Ubuntu 16.04.5 LTS 3.4.113-sun8i
  11. Hello, Contact bounce is not problem. I have 1nF Cap on it ... Without cap is button like this unusable.
  12. Hello everybody. I'm little bit confused with this think. Which libraries are good (best) for H5 OPiZeroPlus board .? - WiringPI - ArmbianIO - GPIOzero or ..?? I have small script for timer switch, but it is not stably as well as I can. Button press is not accurate. (some pull-up/down are missing probably) Thanks for answer or suggestion. (PS: I'm not a programmer guru)
  13. ...I forgot... you must enable all these services.. systemctl enable bluetooth-bt-agent.service systemctl enable bluealsa.service systemctl enable bluealsa-aplay.service
  14. ..so another talking with myself .. Here is some scripts to automate pairing and playing, if you can use Opi as Bluetooth speaker. script for automated pairing ... we need to create PIN file list and run bluealsa & bluealsa-aplay as service on startup... ..and play some sounds..