Super new to this.
I need a physical button pusher (solenoid) to reboot a mobile hotspot.
It should be triggered automatically when the raspberry pi loses wireless network signal.
Need the code since I’ve never coded.
I can donate $ for the assistance.
Super new to this.
You might want to take a look at Liam’s thread on hacking electronics, it goes over how to “push” a button with a microcontroller:
The solenoid route is a valid one, but solenoids require a bit more effort to drive:
As for the code, what you’re looking to do isn’t too hard, it was actually my first project that I did with an ESP8266 (now replaced by the ESP32) It pinged google then fired a relay to turn off the DC supply to our router. I’d look into the basics of Python and GPIO on a Pi, and ways to check for network connectivity
Thanks for the links. I got my homework assignments.
James a couple more questions please.
I have 40 acres of VERY remote property 600 miles from my home. I have IP cameras on local wifi network from a Verizon 4lte mobile hotspot. Solar 5v - 12v DC. No AC power.
ie Sometimes a Verizon update or power surge or overheating powers down the hotspot. The hotspot has a manual button to push on.
I need the hotspot button pushed for 4 seconds (by the solenoid) automatically.
I have the circuit built for the push-pull solenoid.
I can’t figure out code to have the solenoid activate (for 4 sec) when the raspberry pi 3B loses the integrated wifi signal.
Thanks for the help.
Using Tim’s code from the guide we can adapt that to keep the solenoid extended for a bit longer (note: solenoids usually like being activated very sparingly, <1 second on, >4 seconds off).
#Import all neccessary features to code. import RPi.GPIO as GPIO from time import sleep #If code is stopped while the solenoid is active it stays active #This may produce a warning if the code is restarted and it finds the GPIO Pin, which it defines as non-active in next line, is still active #from previous time the code was run. This line prevents that warning syntax popping up which if it did would stop the code running. GPIO.setwarnings(False) #This means we will refer to the GPIO pins #by the number directly after the word GPIO. A good Pin Out Resource can be found here https://pinout.xyz/ GPIO.setmode(GPIO.BCM) #This sets up the GPIO 18 pin as an output pin GPIO.setup(18, GPIO.OUT) while (True): #This Turns Relay Off. Brings Voltage to Max GPIO can output ~3.3V GPIO.output(18, 1) #Wait 1 Seconds sleep(1) #Turns Relay On. Brings Voltage to Min GPIO can output ~0V. GPIO.output(18, 0) #Wait 1 Seconds sleep(4) # The time the relay is extended
Another option that would be worth exploring is ditching the solenoid all together, if you are able to access both connections to the switch and connect them to the NO and COM terminals of the relay you are able to emulate a button press (the connections on the relay will short NO and COM when the relay is activated - much like a button).