Remote pump control ideas.
Collapse
X
-
Re: Remote pump control ideas.
yes - a big stm chip - not like the bluepill.
bluepill is a good step forward from AVR's, but there are some fakes around now.
btw, you can get stm boards with standard arduino size boards with the usual headers if you have a shield already.
just remember the i/o is 3.3vLast edited by stj; 10-20-2020, 04:01 AM.Comment
-
Re: Remote pump control ideas.
That goes slightly over my head, but speaking of which: these are much nicer packed than I expected and the packaging mentions something about them coming pre-loaded with some stuff, and it would be a shame to lose that if it CAN be used in any way for my project here. I haven't even plugged them in to see what they do, so I don't know anything about them yet.
Like I said: since I'm pressed for time, I'll just go ahead and "sacrifice" and butcher these two to run my POS Arduino code so I can get it off the ground already, but in the future, I'll DEFINITELY want to play around with the more advanced features of these, since they look really capable and it would be a shame to waste that potential. What's funny here is that Arduino, which is a dumber version for beginners, is actually more expensive than these Nucleos ! I was going to go with two Arduino Yun for this project, but the price is nearly double, for less the performance ! ! Sure, you need to KNOW how to unlock that performance to make full use of it, but it's there if you need it...kinda like having a supercar: it can go slow for city driving, but it certainly can also go to the tracks if need beWattevah...Comment
-
Re: Remote pump control ideas.
the pre-load is in the virtual-usbdrive on the stlink part.
or it will have a weblink.
it's all in the cube software anyway.
btw, to flash code into nucleo's you just copy your bin or hex into the virtual usbdrive and the stlink will instantly flash it to the main board over the debug interface.
it's disgustingly simple!!
Last edited by stj; 10-20-2020, 02:25 PM.Comment
-
Re: Remote pump control ideas.
). Since I'll be using the ino. file my Arduino IDE spits out, or rather "uploads", I won't be able to use this feature, at least yet, since I plan on doing it right with the next ones when I'll hopefully have more time to learn. I watched some tutorials, like I said, but I'm the kind of guy who really sucks at retaining large chunks of information all at once if I'm not actually DOING that thing, so I have to practice on my own, mess it up, fix it, break it again, fix it some more and so on....
Wattevah...Comment
-
Re: Remote pump control ideas.
https://www.carminenoviello.com/2016...nucleo-f746zg/
thid guy is a master - he writes books on this stuff
and this link should be bookmarked - it's the firmware updates for the stlink section.
https://www.st.com/en/development-to...w-link007.htmlLast edited by stj; 10-21-2020, 12:42 PM.Comment
-
Re: Remote pump control ideas.
How is the power consumption of the board?
I'm not sure what is going on at the tank station but can't see solar power working with Ethernet, it uses a lot of current. Then just go POE if there is a cable run?
I did not take the plunge into STM32 family, all these ARM MCU's have 1,200+ page datasheets which seem ridiculous for one person to learn and be proficient at. For now going with ATSAMD51 boards for higher performance or ESP32.Comment
-
Re: Remote pump control ideas.
I did not take the plunge into STM32 family, all these ARM MCU's have 1,200+ page datasheets which seem ridiculous for one person to learn and be proficient at. For now going with ATSAMD51 boards for higher performance or ESP32.Comment
-
Re: Remote pump control ideas.
No idea how much power the board uses (when powered with 12v that is), since I haven't taken it out of the packaging yetThe GPON will also draw some power of its own.
I'm still working on the code on my Arduino, since I wasn't happy with how it turned out the first time and I want to do a better job at both writing it AND implementing the whole idea. This time I WILL actually share it, since I feel more confident I won't get roasted as hard
I started getting the hang of it better and now understand functions, since that's always been confusing AF to me as to how to pass info back and forth between the main loop and the function and also "returns" and stuff like that. It all becomes SO easy when you understand the program runs line by line, even if extremely fast which makes it look like more things happen at once - they don't - they just feel that way, like persistence of vision...again, this is all in layman termsWattevah...Comment
-
Re: Remote pump control ideas.
power can be reduced to nothing,
you can shutdown the i/o in blocks so only the core runs, and even change the clockspeed on the fly.
you can also stall the core and have it start on an interupt from a pin or from a built-in RTC so you can have it do something every second, every hour or every day - whatever you can think of - the RTC even has it's own power pin so you could hook it to an 18650 circuit or something.Comment
-
Re: Remote pump control ideas.
Here's what I concoctedIt works as I expect it to work. Big shoutout to STJ for giving me this idea...sort-of
There's two pieces of code: one for the hilltop tank, the other for the pump at the bottom, as previously described. The client is now at the bottom shack (the pump side). This idea allowed me to simplify the code immensely and remove A LOT of clutter.
I'm sure there's stuff which can be improved (for instance the lack of comments, which I'm aware of), but remember: this is extremely basic, suitable for your average beginner.
Client side:
Code:#include <SPI.h> #include <Ethernet.h> byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xBB }; //Arduino Client MAC address // If you don't want to use DNS (and reduce your sketch size) // use the numeric IP instead of the name for the server: IPAddress testServer(10, 11, 5, 239); // IP of the first server to poll client //IPAddress testServer2(10, 11, 5, 170); // IP of the second server to poll //char server[] = "www.google.com"; // OR name address using DNS //If DHCP is not available, the following addresses will be used by default IPAddress ip(10, 11, 5, 170); // The static IP address that will be used if DHCP is not available IPAddress myDns(193, 231, 242, 2); // IP of DNS server IPAddress gateway(10, 11, 5, 1); // IP of Default Gateway IPAddress subnet (255, 255, 255, 0); // Subnet Mask // Initialize the Ethernet client library // with the IP address and port of the server // that you want to connect to (port 80 is default for HTTP): EthernetClient theClient; //Some variables to store different stuff const int maxFailCount = 5; const int pollInterval = 5000; unsigned long lastPoll; int failCount = 0; int getStatus = 0; bool clientConnected; bool commErr; void setup() { Serial.begin(9600); // Open serial communications and wait for port to open while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } while (Ethernet.linkStatus() == LinkOFF) { Serial.println("No link. Check ethernet cable..."); delay (2000); } Serial.println("Attempting to obtain DHCP lease..."); if (Ethernet.begin(mac) == 0) { Serial.print("Failed to configure Ethernet using DHCP - "); //Attempt DHCP first and return this message if failed if (Ethernet.hardwareStatus() == EthernetNoHardware) { Serial.println("Ethernet module not found or faulty..."); // Check for Ethernet shield and stop if not found while (true) { delay(1); } } Ethernet.begin(mac, ip, myDns, gateway, subnet); // Switch back to static IP (set above) if DHCP failed Serial.print("Set static IP Address as "); Serial.println(Ethernet.localIP()); //Print static IP to serial Monitor Serial.print("Gateway set as "); Serial.println(Ethernet.gatewayIP()); //Print gateway IP to serial Monitor Serial.print("Subnet mask "); Serial.println(Ethernet.subnetMask()); //Print subnet mask to serial Monitor Serial.print("DNS Server "); Serial.println(Ethernet.dnsServerIP()); } //Print DNS Server IP to serial Monitor else { Serial.print("Obtained DHCP lease. IP is "); // Print dynamic address if DHCP was successful Serial.println(Ethernet.localIP()); Serial.print("Gateway IP is "); Serial.println(Ethernet.gatewayIP()); Serial.print("Subnet Mask is "); Serial.println(Ethernet.subnetMask()); Serial.print("DNS Server IP is "); Serial.println(Ethernet.dnsServerIP()); } delay(2000); // give the Ethernet shield a second to initialize: // You can use Ethernet.init(pin) to configure the CS pin //Ethernet.init(10); // Most Arduino shields //Ethernet.init(5); // MKR ETH shield //Ethernet.init(0); // Teensy 2.0 //Ethernet.init(20); // Teensy++ 2.0 //Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet //Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet // bitClear(DDRD, 2); // PIN 2 configured as input pin // bitSet (DDRD, 3); // PIN 3 configured as output pin // bitSet (DDRD, 4); // PIN 4 configured as output pin bitSet (DDRD, 5); // PIN 5 configured as output pin bitSet (DDRD, 6); // PIN 6 configured as output pin tone(3, 1000, 1000); //startup } void loop() { Ethernet.maintain(); if (clientConnected == false) { if (theClient.connect(testServer, 23)) { clientConnected = true; failCount = 0; } else { if (failCount < maxFailCount) { failCount++; } if (failCount >= maxFailCount) { commErr = true; } delay(1000); } } if (clientConnected == true) { pollServer(); if (getStatus == 1) { bitSet(PORTD, 5); } else if (getStatus == 0) { bitClear(PORTD, 5); } } if (commErr == true) //on comm failure light up indicator, low beep, stop pump { bitSet(PORTD, 6); tone(3, 200, 100); bitClear(PORTD, 5); } else { bitClear(PORTD, 6); //turn off indicator if connection resumes } } void pollServer() { failCount = 0; //reset fail counter on each iteration of pollServer function bool invalidResponse; do { String commandString; do { if (millis() - lastPoll >= pollInterval) { theClient.print("POLL\n"); lastPoll = millis(); if (failCount <= maxFailCount) { failCount++; } if (failCount > maxFailCount) { clientConnected = false; commErr = true; return; } } } while (!theClient.available()); while (theClient.available()) { char c = theClient.read(); if (c != '\n') { commandString += c; // Read char until linefeed, then add received char to commandString variable } else { Serial.println("SwitchStatus: " + commandString); if (commandString == "ON") { getStatus = 1; //do this if ON arrives commErr = false; tone(3, 1000, 100); return; } else { if (commandString == "OFF") { getStatus = 0; //do this if OFF arrives commErr = false; tone(3, 1000, 100); return; } else { invalidResponse = true; //do this if something else arrives (retries polling) } } } } } while (invalidResponse == true); }
Last edited by Dannyx; 10-22-2020, 06:41 AM.Wattevah...Comment
-
Re: Remote pump control ideas.
Server side code
Code://SOURCE: http://www.handsonembedded.com/arduino-ethernet-shield/ #include <Ethernet.h> #include <SPI.h> byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xAA }; // Arduino Server MAC address const int port = 23; // Stores the value of the local port used to listen for incoming clients //If DHCP is not available, the following addresses will be used by default IPAddress ip(10, 11, 5, 170); // The static IP address that will be used if DHCP is not available IPAddress myDns(193, 231, 242, 2); // IP of DNS server IPAddress gateway(10, 11, 5, 1); // IP of Default Gateway IPAddress subnet (255, 255, 255, 0); // Subnet Mask EthernetServer theServer(port); // Create a sever object, name it "theServer" and have it listen on the port specified above (23) unsigned long commandTime = 0; const int debounceTime = 2000; int tankStatus; void setup() { Serial.begin(9600); // Start serial monitor if (Ethernet.linkStatus() == LinkOFF) { Serial.println("No link. Check network cable..."); //Link status check. Stop if not connected. Note that this only works on W5500 boards and is skipped otherwise ! delay (2000); } Serial.println("Attempting to obtain address by DHCP..."); if (Ethernet.begin(mac) == 0) { Serial.print("Failed to configure Ethernet using DHCP - "); //Attempt DHCP first and return this message if failed if (Ethernet.hardwareStatus() == EthernetNoHardware) { Serial.println("Ethernet module not found or faulty..."); // Check for Ethernet shield and stop if not found while (true) { delay(1); } } Ethernet.begin(mac, ip, myDns, gateway, subnet); // Switch back to static IPs (set above) if DHCP failed and print out their values Serial.print("Default IP Address is "); Serial.println(Ethernet.localIP()); Serial.print("Gateway IP is "); Serial.println(Ethernet.gatewayIP()); Serial.print("Subnet mask is "); Serial.println(Ethernet.subnetMask()); Serial.print("DNS Server IP is "); Serial.println(Ethernet.dnsServerIP()); } else { Serial.print("DHCP assigned IP is "); // Print dynamic address if DHCP was successful Serial.println(Ethernet.localIP()); Serial.print("Gateway IP is "); Serial.println(Ethernet.gatewayIP()); Serial.print("Subnet mask is "); Serial.println(Ethernet.subnetMask()); Serial.print("DNS Server IP is "); Serial.println(Ethernet.dnsServerIP()); } bitClear(DDRA, 0); // Set Digital pin 22 on the Mega as an INPUT for "RUN" bitClear(DDRA, 1); // Set Digital pin 22 on the Mega as an INPUT for "STOP" bitSet(DDRA, 2); // Set Digital pin 24 on the Mega as an OUTPUT for "MCU OK" indicator bitSet(DDRB, 7); // Set LED pin 13 on the Mega as an output for switch status delay(2000); // give the Ethernet shield a second to initialize: theServer.begin(); bitSet(PORTA, 2); //status LED } void loop() { Ethernet.maintain(); //probably good to disable if DHCP is not used??? while (bitRead(PINA, 0) == 1) //tank level is low and needs filling. ON contact is active (MCU pin is HIGH due to 74HC14 inverter) { commandTime = millis(); break; } while (bitRead(PINA, 0) == 1) { if (millis() - commandTime > debounceTime) { if (bitRead(PINA, 1) == 0) { bitSet(PORTB, 7); //check if the OFF contact is not stuck ON tankStatus = 1; break; } else { tankStatus = 2; // break; } } } while (bitRead(PINA, 1) == 1) //tank level is full and pump needs to stop. OFF contact is active (MCU pin is HIGH due to 74HC14 inverter) { commandTime = millis(); break; } while (bitRead(PINA, 1) == 1) { if (millis() - commandTime > debounceTime) { if (bitRead(PINA, 0) == 0) { bitClear(PORTB, 7); //check if the ON contact is not stuck ON tankStatus = 0; break; } else { tankStatus = 2; break; } }// } EthernetClient theClient = theServer.available(); //Get available client wishing to speak to server String commandString; while (theClient.available()) { char c = theClient.read(); if (c != '\n') { commandString += c; // Read char until linefeed, then add received char to commandString variable } else { Serial.println("Command:" + commandString); if (commandString == "POLL") { doReply(); } } } } void doReply() { if (tankStatus == 1) { theServer.print("ON\n"); } else if (tankStatus == 0) { theServer.print("OFF\n"); } else if (tankStatus == 2) { theServer.print("ERR\n"); } }
Wattevah...Comment
-
Re: Remote pump control ideas.
I finally unwrapped the STMs today and had a go with the Arduino IDE. Of course, I did the blinky-LED thing first to keep it as simple as possible. Amazingly, it worked first try: I was expecting errors up the a$$, but it actually uploaded. It took FOREVER to compile though ! No doubt it takes a lot of "work" to go through all this hacky process, plus my laptop is an old POS I keep strictly for messing around on, so that didn't help either.
I am unable to get the serial COM port to work, since I next tried using the DHCP Address printer sketch on it to see if it'd hook up and get an IP address, but I got no serial COM port to choose from to actually SEE if it did anything - it just stood there. Then I went to the list of COM ports and found nothing there, so I'm now struggling to find a driver, since from what I read online it CAN be done....
EDIT: I finally did it. Turns out there's like two different drivers: one for the ST_LINK itself and one for the STM32 "chip"........I didn't know that and kept installing the one for the chip, but not the interfaceCOM9 now shows up. It turns out it doesn't reset the board when I open up the serial monitor, so I have to do it manually using the reset button on the board - I was just sitting there like a dumbass wondering what the heck is going on, so I just hit reset and bang, my IP address showed up.....*OOOOOOOHHHH* I see
Last edited by Dannyx; 10-23-2020, 01:23 AM.Wattevah...Comment
-
Comment
Related Topics
Collapse
-
by tmhobadcapI have this receiver for at least 10 years. Usually, we just use the remote for turning on/off and adjusting the volume. Recently, the remote control started not able to turn the receiver on. Later, the volume also could not be adjusted by the remote control.
At first, I thought that it was the usual problem which can be fixed by cleaning the contacts on the switches and the pcb. I opened the remote and clean it with alcohol. The remote did work again after that. But after one day, it did not work again. I opened it again and clean with alcohol and contact cleaner. Again it worked... -
This specification for the HP Mobile Thin Client mt44 Mobile Thin Client 3JG86EA Mobile thin client can be useful for upgrading or repairing a laptop that is not working. As a community we are working through our specifications to add valuable data like the mt44 Mobile Thin Client 3JG86EA boardview and mt44 Mobile Thin Client 3JG86EA schematic. Our users have donated over 1 million documents which are being added to the site. This page will be updated soon with additional information. Alternatively you can request additional help from our users directly on the relevant badcaps forum. Please note...09-06-2024, 06:50 AM
-
by piipoHi, I have an old Privileg brand 5.1 speakers. I have lost the remote control. I have an universal Harmony remote but there is no Privileg brand in it's software to add. Does anybody have an idea what alternative brand for a remote can I try instead? I'm attaching an image of what the speakers looks like. The image shows 2 main speakers, they are 5 + 1 in total. Thank you very much1 Photo
-
Channel: Troubleshooting Audio Equipment
09-18-2024, 01:55 AM -
-
This specification for the HP mt44 Mobile Thin Client Mobile thin client can be useful for upgrading or repairing a laptop that is not working. As a community we are working through our specifications to add valuable data like the mt44 Mobile Thin Client boardview and mt44 Mobile Thin Client schematic. Our users have donated over 1 million documents which are being added to the site. This page will be updated soon with additional information. Alternatively you can request additional help from our users directly on the relevant badcaps forum. Please note that we offer no warranties that any specification,...09-06-2024, 06:50 AM
-
This specification for the HP mt44 Mobile Thin Client Mobile thin client can be useful for upgrading or repairing a laptop that is not working. As a community we are working through our specifications to add valuable data like the mt44 Mobile Thin Client boardview and mt44 Mobile Thin Client schematic. Our users have donated over 1 million documents which are being added to the site. This page will be updated soon with additional information. Alternatively you can request additional help from our users directly on the relevant badcaps forum. Please note that we offer no warranties that any specification,...09-06-2024, 06:50 AM
- Loading...
- No more items.
Comment