Remote pump control ideas.

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • stj
    replied
    Re: Remote pump control ideas.

    Originally posted by Dannyx
    These Nucleo boards seem to only play nice with their ST-Link programmer - not sure if it's possible to program them some other way - the way you can an Arduino via serial for instance, though on page 75 of the datasheet in post #32 (kudos) I do see STLK RX and TX on the right there, connected to pins 77/78 USART3 RX/TX, so maybe the ST-link portion is like the programmer found on most Arduinos which come with a programmer (the Mini doesn't, hence why an external one is required). This would enable me to actually get one of those serial to ethernet adapters to enable this sort of remote programming....otherwise, I can't, at least not easily, I imagine...
    read the chip datasheet.
    you can program those chips through any port by setting the boot jumper
    so you can upload via usb,serial, even canbus

    the stlink uses a serial version of jtag to not just program the chip but let you communicate with running code.
    (without messing with the boot0 jumper)
    Last edited by stj; 10-08-2020, 03:31 AM.

    Leave a comment:


  • Dannyx
    replied
    Re: Remote pump control ideas.

    Originally posted by Curious.George
    The downside of this is that if you hold the button for an eternity, nothing will happen until you release it -- even if that's hours after your "time limit" has expired.]
    This is the issue I was facing, as described.

    I don't know squat about advanced programming stuff (like threads), hence why I'm using layman terms most of the time. The Arduino IDE uses C++ and from what I understand it's fairly potent, by my standards at least, if you know how to do it. I did it by ear, so stuff is not up to snuff...

    Leave a comment:


  • Curious.George
    replied
    Re: Remote pump control ideas.

    Originally posted by Dannyx
    What I'm trying to achieve is this: say I have a push-button and I want to turn on an LED with it, but only after the button's been held down a number of seconds. When I started playing with millis() for the first time, I tried it like this (this is just a snippet - the variables are declared at the start of the code in the Arduino IDE):

    if ((bitRead(PIND, 5)== 1))
    {commandTime = millis();
    if (millis()-commandTime >= waitTime)
    {run = true;}
    }
    I suspect the environment you're coding in is sorely crippled (single-threaded, etc.).

    If you can afford to spin in a routine that just watches a button press, then the easiest way to do this is to watch for the button to be depressed ("was=OFF, is=ON") and store that "time". Then, when you see the button released ("was=ON, is=OFF") look at the elapsed time (now - pressedtime) and, if it exceeds your limit, do "whatever".

    I.e., you initiate the action when the button is released (like how windows does things when a mouse is "unclicked" instead of "clicked").

    The downside of this is that if you hold the button for an eternity, nothing will happen until you release it -- even if that's hours after your "time limit" has expired.

    [A smarter way of doing this is to have a dedicated thread that just watches the button(s) and captures the "current time" when it notices certain "events". Then, set timers that trigger actions when they expire. If something happens that causes you to NOT want that action to occur (e.g., the button is released "early"), then you kill the timer.]

    [[I don't play with arduinos and their ilk so I can't tell you what you can or can't do in those environments]]

    Leave a comment:


  • Dannyx
    replied
    Re: Remote pump control ideas.

    Let's talk code now Having a look through my code and wanting to learn to do it better instead of just "good enough to work", I started looking at parts which seem overly-complicated for doing just a simple thing and looked into ways of doing them properly. Some of them I was able to do, but others not so much and I need help

    One such instance is using millis() to count down since the start of an even. The way I do it works but seems messy and it may not be the best practice.

    What I'm trying to achieve is this: say I have a push-button and I want to turn on an LED with it, but only after the button's been held down a number of seconds. When I started playing with millis() for the first time, I tried it like this (this is just a snippet - the variables are declared at the start of the code in the Arduino IDE):
    Code:
    if ((bitRead(PIND, 5)== 1))
     {commandTime = millis(); 
      if (millis()-commandTime >= waitTime)
         {run = true;}
     }
    I now know this doesn't work because as long as the button is held down, the variable commandTime is being CONSTANTLY fed the value of millis() in real time, so the subtraction below constantly equals zero and never reaches reaches the value of waitTime. This is the issue: I can't figure out a way to "capture" millis() into a variable.

    I WAS able to do it like this, by using a second boolean, commandStarted, to kinda sort-of "freeze" the execution of commandTime=millis() so it only runs once *BAM*, capturing the current millis():
    Code:
    if ((bitRead(PIND, 5)== 1))
     {if (commandStarted == false)
        {CommandStarted = true;
         commandTime = millis();} 
      if (millis()-commandTime >= debounceTime)
         {run = true;}
     }
     else {stopCommandStarted = false;
    }

    This works, but I wonder if it can be even easier and cleaner - somehow this doesn't seem particularly professional code-writing to me....not that I ever claimed to be a pro, like I said. I'm learning as I go. Also, I'm aware that using ports like that in the code itself is not ideal either - they should probably be declared too
    Last edited by Per Hansson; 10-11-2020, 04:27 AM. Reason: Added CODE tags for readability

    Leave a comment:


  • Dannyx
    replied
    Re: Remote pump control ideas.

    These Nucleo boards seem to only play nice with their ST-Link programmer - not sure if it's possible to program them some other way - the way you can an Arduino via serial for instance, though on page 75 of the datasheet in post #32 (kudos) I do see STLK RX and TX on the right there, connected to pins 77/78 USART3 RX/TX, so maybe the ST-link portion is like the programmer found on most Arduinos which come with a programmer (the Mini doesn't, hence why an external one is required). This would enable me to actually get one of those serial to ethernet adapters to enable this sort of remote programming....otherwise, I can't, at least not easily, I imagine...

    Leave a comment:


  • stj
    replied
    Re: Remote pump control ideas.

    you could write a bootloader in flash to load the main code from usb/sd into ram and run it.
    then you just need to remotly overwrite the usb/sd and reboot the board.
    but you shouldnt - security is important.

    Leave a comment:


  • Dannyx
    replied
    Re: Remote pump control ideas.

    The enclosures are actually plastic, if not clear from the pictures, and they're both located inside shacks, so they're not in direct sunlight, though I imagine the one with the battery, located at the top of the hill, CAN get pretty warm in the summer when the sun's beaming down on the shack directly. The water tank located nearby may have a nice cooling effect though.

    I think the fan is a good idea in the long run, though not ideal for energy conservation. There are plans to wire the tank shack to utility power as well, but it won't happen in the near future, so battery power is the way to go for now I'm afraid. I'll definitely tidy stuff up once I actually get started, like actually moving that battery towards the middle of the box

    Now that you mention it, a 400v contactor carrying several amps opening right next to my STM32 would not be a very bright idea....I may have to install a separate box after all. These guys won't like the extra expenses, because everything has to be done on a budget, but it HAS to be done....

    Speaking of which, I was a total d!ckhead and forgot to take a picture of the model of that contactor, since as it stands I have no idea if the coil is 230v or 12v. I think it's 230v, because I see a small intermediary relay to the far left (next to that phase monitoring thing) which I think drives the 230v for the coil...

    Leave a comment:


  • redwire
    replied
    Re: Remote pump control ideas.

    Both ends look not so great. The tank end has a cooling fan but the intake grille is blocked by the battery. Who has extra power to run the fan? I got longer battery life putting insulating foam on the battery bottom as the metal box gets hot in sun and is like a hot plate so the battery was hot at the bottom and cold up top.
    The pump end is stupid having mains and other wires 1" away from the GSM cell modem antenna pcb trace, or going underneath. It's going to make tons of noise. Oh and ANOTHER COOLING FAN? There's not so much heat here unless this is the middle east.

    I would find out what the USB port does on these boards, maybe read out the program?

    Leave a comment:


  • Dannyx
    replied
    Re: Remote pump control ideas.

    Another thing just dawned on me: any way of implementing some sort of "out of band" access on these STM boards ? I know that's not actually the proper name for what I'm trying to achieve: I need a way of uploading code and viewing the serial monitor from the boards remotely, just as if I were sitting next to it with my PC.

    I got the idea from another project which was passed down to us, where some serial-to-LAN adapters allow otherwise purely serial alarm control panels to talk to a head office over the network - something like that, so I don't have to be in close proximity to the board to alter the code, upload a new idea or simply view the serial monitor. Those use Lantronix Xport modules to do the job, but they're pretty expensive....

    Leave a comment:


  • Dannyx
    replied
    Re: Remote pump control ideas.

    Originally posted by stj
    did you check that paperwork? it may have said when the battery was installed.
    No and I forgot to ask the chap when the system was deployed, since I'm betting it hasn't been replaced since. I'll use our battery tester to check it the next time we go there. It will need charging first, which will not be easy on top of a hill with no utility power available. Will probably have to get it back down, charge it, then return it to the top...sounds fun

    Leave a comment:


  • stj
    replied
    Re: Remote pump control ideas.

    did you check that paperwork? it may have said when the battery was installed.

    Leave a comment:


  • Dannyx
    replied
    Re: Remote pump control ideas.

    I finally went to see this pump control system in person and take some pics of my own. It's about what I expected. The tank is located up on a high hill and its control box is solar-powered by that blue charge controller and battery. The battery appeared to be flat, according to the flashing red LED on the controller, despite the green LED indicating the status of the photovoltaic panel indicating adequate performance. It could be because it's been rather cloudy lately or because the battery itself is long in the tooth, or the controller's faulty somehow - I haven't touched anything at this point.

    Down in the foothills where the pump shack is, there obviously IS constant 3 phase 400v utility power running our box, which is also much more involved: there's the main contactor, an overload switch, a phase monitoring relay and a handful of different goodies for me to play with.

    I'm not sure how to best handle the case where the two ends lose communication. The local official who accompanied me on my visit told me it'd probably be best to just shut off the pump and send an SMS alert to someone, which the system actually does already through its GSM modules, though I'll need to modify this a bit so it's the Arduino who sends out the command to the GSM module when it can no longer ping its buddy up on the hill...

    Other than that, I'm not sure whether I should have a "manual" mode as well, which would allow the pump to be turned on/off locally with some buttons, regardless of the status reported by the MCU up on the hill, as this could lead to someone forgetting it in the ON position and the tank overflowing...
    Attached Files

    Leave a comment:


  • Dannyx
    replied
    Re: Remote pump control ideas.

    Even better. Like I said - I don't know squat about this stuff. I just learn as I go, piecing together various projects and examples to form the end result

    Leave a comment:


  • stj
    replied
    Re: Remote pump control ideas.

    well.... - most of those boards have usb-otg, so you could just use a usb-stick instead of a card.

    Leave a comment:


  • Dannyx
    replied
    Re: Remote pump control ideas.

    Originally posted by stj
    btw probably obvious,
    Nope, so thanks for clearing that out - it's probably mentioned somewhere in the documentation which I haven't read because I've become a lazy bum lately

    One thing I DID read is that they're compatible with Arduino shields, so I might add a card slot to host a control webpage....don't know how to do that just yet, but it's good to know it can handle it.

    Leave a comment:


  • stj
    replied
    Re: Remote pump control ideas.

    btw probably obvious,
    L = low power
    F = fast
    H = dual-core version of F!
    first number afterwards is the core series.
    3 being low spec, 4 is good, 7 is serious power!

    last 2 digits is the pheripherals on the chip

    so an F7 is seriously powerfull
    Last edited by stj; 09-26-2020, 04:32 PM.

    Leave a comment:


  • Dannyx
    replied
    Re: Remote pump control ideas.

    Ok, I just screwed up - L496 doesn't have eth (no RJ45)....I was looking through the specs and missed that part entirely F767ZI has it...
    Last edited by Dannyx; 09-26-2020, 03:25 PM.

    Leave a comment:


  • stj
    replied
    Re: Remote pump control ideas.

    look at the databrief, it will list which have ethernet, then go for big memory if your concerned,
    i have an F746ZG somewhere here - that's pretty high end, with 1meg of flash.
    compare that to 32k in your nano/micro!!

    Leave a comment:


  • Dannyx
    replied
    Re: Remote pump control ideas.

    Should I be worried my sketch is too big to fit on one of those things or other stuff down the line which would make my project not run so well on a different board than the one it got conceived on ?

    I found the L496ZG for a decent price, which is less than an Arduino Yun which I originally had my eyes on...
    Last edited by Dannyx; 09-26-2020, 01:59 PM.

    Leave a comment:


  • stj
    replied
    Re: Remote pump control ideas.

    nucleo144 boards -most have ethernet.

    and here is an arduino support page for which boards it supports
    https://github.com/stm32duino/Arduin...leo-144-boards
    Attached Files

    Leave a comment:

Related Topics

Collapse

  • tmhobadcap
    Pioneer VSX-522-K remote control not working???
    by tmhobadcap
    I 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...
    12-24-2020, 01:44 AM
  • Document Archive
    HP Mobile Thin Client mt44 Mobile Thin Client 3JG86EA Mobile thin client Specification for Upgrade or Repair
    by Document Archive
    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
  • piipo
    Old Privileg 5.1 speakers remote control question
    by piipo
    Hi, 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 much
    09-18-2024, 01:55 AM
  • Document Archive
    HP mt44 Mobile Thin Client Mobile thin client Specification for Upgrade or Repair
    by Document Archive
    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
  • Document Archive
    HP mt44 Mobile Thin Client Mobile thin client Specification for Upgrade or Repair
    by Document Archive
    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.
Working...