Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, an initiative of Stroud Water Research Center designed to help people advance knowledge and stewardship of fresh water.
New to EnviroDIY? Start here

12 V External Power and Serial Viewer

Home Forums Infrastructure and Equipment 12 V External Power and Serial Viewer

Viewing 3 reply threads
  • Author
    Posts
    • #18074
      Apryl
      Participant

        I feel like there should be a simple solution to this, but I haven’t stumbled upon it yet.  The 1.1 version of the Mayfly board now needs a DC converter connected to the USB C port in order to have 12V external power.  When connected this way, everything seems to work.  However, I can no longer access the terminal viewer while the converter is connected and our sensors won’t run without a 12V power source.  So my question is how do I access the terminal viewer while still having external 12V power supplied to the Mayfly?

      • #18076
        Shannon Hicks
        Moderator

          You are correct, if you’re using the USB jack to power a v1.0 or v1.1 Mayfly using a 12v source, then there’s no way to interface the Mayfly with a PC for programming or viewing serial output.  However, all Mayfly boards include an FTDI jack that allows you to connect a variety of FTDI cables or adapters in order to communicate with the board in the event of a broken or otherwise occupied USB jack.

          Check out this post I wrote last year describing how to connect a small board called the Adafruit CP2104 Friend to a Mayfly:  https://www.envirodiy.org/topic/pc-and-mac-unable-to-communicate-with-mayfly-ver-0-5b/#post-16736

          Be sure to scroll down to the bottom of that thread to see the photo I posted showing how you’ll need to solder some right-angle header pins to the end of the Adafruit board in order to plug it into the Mayfly.  Adafruit has since updated and renamed the board the CP2102 Friend but it can be used the same way.

          If you don’t want to have to solder something, then you can purchase the older FTDI Friend model that is shipped with long double-ended male pins to let you connect it to the Mayfly with no soldering required.  I wrote about it here:  https://www.envirodiy.org/topic/com-ports-not-connecting-to-logger/#post-15418

          The older FTDI model uses a different chip than what is used on the newer Mayfly boards, so you might have to install some drivers if you use that one, I mention this in that post along with a photo of the correct way to connect the board to a Mayfly.  You could also use an FTDI cable, though I don’t know if it comes with the long pin headers so you might have to buy those separately.

          Another thing to note, there is a CP2102 USB interface chip built into every Mayfly v1.0 or v1.1.  That’s what allows you to communicate with a PC via the USB jack.  If you connect a separate computer interface board via the FTDI jack, like any of the boards mentioned above, it’s a good idea to disable the Mayfly’s onboard CP2102 chip to avoid hardware conflicts and errors when uploading a sketch.  The small brown block next to the Mayfly’s power switch contains 2 small dip switches.  Here’s a description of them from the Hardware Details page:

          Power LEDs and DIP switches:  LEDs indicate board power (green) and USB power (orange).  Useful for easily seeing if the board is on and if USB power is connected.  Green LED will be lit anytime the board has power and the power switch is in the ON position.  Orange LED will be lit anytime power is being supplied through the USB or FTDI connectors.  If Mayfly board is deployed in a sleeping logger station, it is recommended to set both DIP switches to the OFF position in order to save battery power.  Use a small pointed object to gently slide the small white squares of the DIP switch either to the ON or OFF positions.

          So if you’re powering your Mayfly with the USB jack, you’ll be wasting a lot of power keeping the LEDs on and also powering the onboard USB converter chip.  I would recommend turning both switches to OFF during your deployment, but you’ll need to remember to turn the USB switch back on if you ever want to reprogram the Mayfly via it’s onboard USB jack in the future.  Here’s something I wrote on the technical discussion thread last year:

          The dipswitches are mainly there to let people know their board is working during initial testing or desktop deployments.  Anytime a board is deployed in the field as a “sleeping” station, power savings are important during the sleep period.  So I put the dipswitches on the new versions of the Mayfly to allow people to deactivated the LEDs.  The dipswitch for the green LED only cuts power to the green LED and nothing else, but it will save you about 2 mA.  The orange LED is only on if power is being supplied through the USB jack, like when connected to a computer or when powering from the USB jack like what that converter will do.  Whenever the USB jack is powered and the USB dipswitch is on, the LED is on plus the USB converter chip, which draws some not-insignificant power, so turning off the USB dipswitch will save power and prevent the USB converter from being on constantly.  However, you’ll just have to remember to turn that dipswitch on again in the future if you ever decide to reprogram that Mayfly or want to connect to the Serial Monitor to see some output.

        • #18077
          neilh20
          Participant

            The Mayfly 1.1 is great for powering options – but it does mean understanding the tradeoffs.

            For an FTDI cable,  for debug monitoring of the Mayfly this is what I do – https://github.com/neilh10/ModularSensors/wiki/Test-Equipment-FTDI-cable

            I also cut some pins to make it a “monitoring cable” that won’t cause a reset when the FTDI USB is plugged in to the monitoring computer. But only do that when you follow how the download works.

            When programming the Mayfly I always use the USBC cable, and insure I disconnect the FTDI monitoring cable – as technically they are doing the same job and may fight (electrically speaking)

            I would think  +12V could also be provided to the Mayfly 1.1 Solar2 socket.  All possible options – but only if you follow how the circuits work. Using Solar2 would allow the USB-c to be used with the terminal.

            I use the board with a solar panel, and so it always has a LiPo 4.4Ahr battery plugged in. On the test bench with LiPo I don’t always need the external power, unless the battery needs charging. 🙂

            • #18103
              Apryl
              Participant

                Thanks for the info! That may explain why I can’t seem to get the sketch to upload via the FTDI while I have a converter plugged into the USBC, but I had though that turning off the DIP switch would take care of that. 🙂

              • #18104
                Apryl
                Participant

                  So, if I understand correctly, I should be able to use the USBC to Serial (CP2102N Friend, oriented properly)  via the FTDI port to upload sketches as well as access the serial monitor with the 12V to 5V DC converter plugged into the Mayfly’s USBC port (for the sensors that require 12V), but the DIP switch for the USBC on board chip needs to be off. With the exception that if I want to upload code via the Mayfly’s USBC port (not the FTDI), then I would need to turn that switch back on.

                  With the CP2102N connected, correct com port selected, most recent UART drivers installed, the DIP switch for the USBC onboard chip set to off and the 12V to 5V dc converter connected through the Mayfly’s USBC port I get:

                  avrdude: stk500_recv(): programmer is not responding
                  avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x3e error

                  when trying to upload a sketch.  Turning the DIP switch to on gets the same response.

                  As for the serial monitor all that comes up is a timestamp, and it is opening without any errors.  The code is running and writing data to the sd card and the code version is unchanged from the one I have been using with the 0.5v boards.  So I am not sure why nothing shows up on the monitor.  I also tried another new Mayfly board, just on the off chance that something was wrong with this one.  However, results were the same. Suggestions on what I should check next? 🙂

                  Apryl

              • #18108
                Shannon Hicks
                Moderator

                  If you’re using an external FTDI or CP2102 interface board to program your Mayfly via the Mayfly’s FTDI socket, then the Mayfly dipswitch labeled USB should be turned off before connecting the external interface to the Mayfly, and it should stay off the entire time.

                  What version of the Arduino IDE are you using?  From your screenshot, it looks like you might be using one of the newer versions.  On our software instructions page here:  https://www.envirodiy.org/mayfly/software/    we recommend that you use the Legacy v1.8.x version since there are some quirks about the newer v2.0 and web-based Arduino IDE’s that can cause issues with the Mayfly.

                  When you plug your CP2102 Friend into your computer’s USB port, what does Windows Device Manager say?  Does a “Silicon Labs CP210x USB to UART Bridge (COMx)” show up under the “Ports (COM & LPT)” list, or is it shown under an Unknown Device tab with a yellow triangle?

                  • #18160
                    Apryl
                    Participant

                      Sorry for the delayed response.  I am just getting back to this again.

                      The IDE version I am using is 1.8.13.

                      In the Windows Device Manager, when the CP2102 is plugged in it reads “Silicon Labs CP210x USB to UART Bridge (COM10)” under the Ports (COM & LPT) currently.

                      So, today everything seems to work.  The following is info that may or may not be helpful as I don’t really know why it wasn’t working before.  There may have been a glitch with the DC-DC converter, or just as likely, a coincidence. I connected through the FTDI socket and was getting a getting a power surge warning on the usb port prior to even turning on the Mayfly.  This was new.  I had not yet connected a 12V power source, though the DC-DC converter was plugged into the Mayfly’s usbc port (and had been without a power source for a few weeks).  I Disconnected the DC-DC converter from the system and the error went away.  I was also then able to upload through the FTDI socket.   Plugging the converter back in, adding in the 12V power source, the FTDI socket still works and the serial monitor displays the sensor data. So, I guess I am set for now.

                      Thank you again for your help!

                Viewing 3 reply threads
                • You must be logged in to reply to this topic.