Also their exist lora radios that can be controlled via arduino. The range would only be 4/5 km. They could connect to the relay.
Remote control via the web could be useful in some situations. But what we’re looking for to begin with is to get a node to automatically power back on after power loss, wholly independently. This way solar powered nodes, which may suffer seasonal outages due to lack of sun or other reasons, would come back online without human intervention. Currently, the power button must be manually cycled to achieve this, which can be inconvenient if your node is a 40’ climb or a 4 mile drive, for instance.
Looked up the lora radio standards. Interesting stuff that could come in handy for remote linking, supervision, and oversight of mesh networks. Once we get the power to stay on through thick and thin.
use a arduino to control the relay, when it senses enough light it turns on the relay.
Did you solve the stay on problem?!?
I think so. Bigger panel (6 W) and a bigger battery pack (8000 mAh) was working wellin the latter half of last winter. They’ve been very reliable all summer long, so if they make it through the dead of winter, it’s good on the power supply side.
On the GTM side, nothing new, just gotta make sure the power stays on.
I think I have a solution for keeping it on… or at least making it come on again after power is available. I just finished testing some of the basic principles.
Someone had hit on it earlier… I am using an arduino nano with an optoisolator (A817, if anyone cares… just happened to have a few sitting around).
By wiring the optoisolator output pins into the power switch as MikeL did above (only two pins needed though - center and one of the switches outside pins ), I scribbled a short arduino sketch (program) that will operate the switch for different periods of time to simulate a quick press, a 1 second press (for turning ther GTM on), and a long press (for turnng it off… about 4 seconds… but I’m testing still).
The logic is this… a 1 second press will turn the unit on, if it has power. If it’s already on, a 1 second press doesn’t do anything (thanks for that!!)
My thinking is to program the arduino to do a 1 second press however often you like, and then sleep/delay for awhile. Say we do it every hour. If the unit is on, nothing happens (that I know of). If the unit is off, and it now has viable power (say it had been charging for awhile after it had shutdown), it will come on.
Next task is to do the keypresses to put it into relay mode (3 short… delay, 3 more short). It will get slightly complicated after that, and I may have to sense the status lights somehow, because I noticed that the keypresses to put it in relay mode are really a toggling logic, which will put it out of relay mode if it’s already in relay mode. Bummer.
The rest is hopefully simple. Here’s a full sample scenario:
Solar charging fails because too little light… external battery pack dies, internal battery eventually dies, and unit goes off.
When the solar charge happens again, the external battery gets charged, the internal battery gets charged, and at some point the arduino will fire up (it’s connected to the external battery), run it’s program and perform the keypresses to start up the GTM.
Hopefully, we’ll then be able to also have it put the GTM into relay mode again.
More to come soon, with diagrams and maybe proof of life video.
For now, here’s the simple test code I used for the arduino nano…
// the loop function runs over and over again forever
void loop() {
secpress(4); // turn unit on… if it’s on, it will stay on with this press
delay(10000); // wait 10 seconds
quickpress(4); // not sure if a shortpress does anything unless it’s in relay mode
delay(5000); // wait 5 seconds
quickpress(4);
delay(15000);
longpress(4); // issue long press to turn unit off
delay(20000); // wait 20 seconds, then start over again
}
void quickpress(int pinnum) { // short keypress for checking unit status (get it to blink)
digitalWrite(pinnum, HIGH);
delay(100);
digitalWrite(pinnum, LOW);
}
void secpress(int pinnum) { // 1-second keypress for starting the unit
digitalWrite(pinnum, HIGH);
delay(1000);
digitalWrite(pinnum, LOW);
}
void longpress(int pinnum) { // long press to turn unit off (4 seconds… testing still)
digitalWrite(pinnum, HIGH);
delay(4000);
digitalWrite(pinnum, LOW);
}
Here’s a rough diagram… doesn’t include the solar panel and charging stuff yet though. This is just the guts to get the automatic button-pushing going.
Here it is working…
The key thing will now be the arduino code to make it bend to my will…
Somewhere in one of the threads I suggested a button sequence to put the Gotenna into a known state.
A four second button push followed by a two second button push puts the Gotenna into the on state non relay mode regardless of what state it was in previously.
Gotenna on > 4 seconds turns it off > 2 seconds turns it on
Gotenna off > 4 seconds turns it on > 2 seconds does nothing
With that logic you will always know the Gotenna is on and in a non relay state before you send it other commands like relay mode.
Of course with the new USB SDK I plan to attach a RPI0W and I will be able to determine the state of the Gotenna without any kludge.
That’s good info… I’ll play with it.
I also just learned that I need to put a resistor inline to the input side of the optoisolator to prevent it from burning out. I guess I had assumed the opto would have one internally, but I guess they typically don’t. A 220 ohm will do the trick, I’d guess, but I’ll be playing with that today.
I am very curious what we’ll be able to do with the USB SDK. I don’t know much about that kind of thing, but if the USB port can tell us what state we’re in, that might be easier than reading the blinking lights with a photocell and some arduino logic, which is what I was planning to do if it comes to that.
I switched to an arduino micro (clone), so to have a micro USB port instead of the mini on the other one. It’s also smaller. I mounted the optoisolator and a resistor (220 ohm) on a piece of stripboard and mounted to underside of the arduino.
Here are some pics:
Next task is to seek power-saving modes for the arduino and find some decent keypress combos to get the GTM into relay mode reliably, and not accidentally take it out of relay mode if it’s already there.
I was originally going to use a relay but I like the optoisolator idea better and have a few laying around from other projects. Thanks for sharing!
NOTE GRAMMAR POLICE: I had to double check whether they were laying or lying around. lol
I originally was going to use a 4066 quad bilateral switch chip, which does much the same thing, I understand. Apply a signal to one pin, and two other pins are connected internally. But I guess the optoisolator adds some circuit isolation to the mix, which is always good for avoiding noise and such. I’d never used either before, so was surprised that it all worked so easily. (I’m not an electronics engineer… just a hobbyist/hack at this stuff.)
Nice work, RandyR. Looking forward to you coming up with a working recipe to accomplish this vital task!
I’m pretty close. Had to add a photocell to detect the light flashes on the unit to assist and make sure we know when it’s on or not. This keeps the arduino electrically separate from the GTM, but let’s us do what we need more reliably. In testing right now.
Plan to scribble up a PDF when it’s all workable.
Is there a way to upload a PDF, or perhaps a dropbox I could drop it into?
Can you post it to a box account and make the document public? I’m not aware of uploading docs to this community.
I remembered that I had a Github account which I’ve never really learned or used, so I posted it there… https://github.com/SkipJ/GoTenna-Mesh-auto-start-project
There’s a PDF document to explain most of it, and a text file or Arduino code.
Ask questions if something doesn’t make sense, or if you see any major errors.
You could try https://hackaday.io. It’s a collaborative tool for hardware hacking. You might get some help from the community there.
(Later EDIT) BE WARNED that this method may not achieve 100% functionality as the USB power circuit alone is insufficient to operate the radio transmitter at full power. Please read the thread below to decide whether this method is useful in your case, and be conservative about any irreversible mods.
(Original post)
I missed this conversation originally, but since I saw it referenced on the USB SDK thread, here’s the recipe that worked for me in an always-on external powered project:
- disconnect the battery (use external power only), then
- force the power switch always-on.
The goTenna will power on with application of USB power and will turn off immediately on de-powering.
Warning: don’t try this at home unless you really REALLY know what you’re doing.
- Hammer your goTenna case open
- Extract mainboard with battery attached
- Detach battery from mainboard using a plastic knife (never use metal tools around lithium batteries)
- CUT THE RED WIRE! (you know you want to)
- Cut the black wire too and remove the battery
- Tape the loose ends of the wires to insulate them.
- Force the power button pressed: rubber-band it if temporary or remove it and solder the pads if permanent.
(alternatively the same result can probably be achieved by jumper-wiring testpoint BUTTON_DIRECT to mainboard GND)
Enjoy your always-on, 9-gram Mesh node! Your quadcopter awaits