2
\$\begingroup\$

I am trying to setup a programmed reset function for a 3.3V BlueTooth module that resets when its reset pin is pulsed LOW for a short period of time. There is a 47K pull-up resistor in the BT module that keeps its reset pin at 3.3V until the reset pin is grounded or sent LOW. So there is no issue with random noise due to the BT pull-up resistor. Can I define the Arduino pin as input and leave it floating, then digitalwrite LOW to reset, then return the pin to floating so the BT module can carry on after the reset? I can't digitalwrite HIGH because the 5V from the Arduino will destroy the 3.3V BT module.

\$\endgroup\$
  • 1
    \$\begingroup\$ This can be done by configuring the pin between an output and an input without pullup, which is done by setting/clearing the direction register bit while leaving the output data register bit low. But you have to accept that any mistake or loading of a program that uses the pin differently will potentially in your words "destroy the 3.3V BT module" Using a positive output to drive the gate of an NFET which would ground the signal could eliminate that risk. \$\endgroup\$ – Chris Stratton Nov 19 '17 at 1:40
  • \$\begingroup\$ Are you implying that bit manipulation is required, or will the pinMode and digitalWrite commands do that for me? For example: Would this work??? - pinMode INPUT // by default it will be floating - pinMode OUTPUT // allow a digitalWrite LOW to ground BT reset pin - digitalWrite LOW // reset the BT module - delay 10 msec // leave it low for a short period of time - pinMode INPUT // hopefully this will return it to floating state but I couldn’t confirm that anywhere... \$\endgroup\$ – DavidCyr2000 Nov 19 '17 at 1:52
  • \$\begingroup\$ It's quite possible something like that could work, but hard to know - if you want to know exactly what happens, you'd need to either audit the code of the Arduino functions, or directly write to the AVR PORTx and DDRx registers. \$\endgroup\$ – Chris Stratton Nov 19 '17 at 1:56
  • 1
    \$\begingroup\$ I think I will wire up the circuit on a breadboard and measure the voltages at each instruction! If I load the pin with a 1K resistor, I should be able to confirm its behavior. Seems the path of least resistance. I am afraid your suggestions are way over my head! I will also try to figure out your suggested use of an NFET, as I am aware that a programming mistake or misuse of the Arduino pin would damage the BT module. Thanks for your help Chris! If I find the answer through breadboarding, I will update this post! \$\endgroup\$ – DavidCyr2000 Nov 19 '17 at 2:08
  • 1
    \$\begingroup\$ As it turns out, someone already answered this question: Leave the pin as input except when you pull the pin low. e.g. pinMode(X, INPUT); // This leaves the pin in a floating state .... digitalWrite(X, LOW); // The pin is now defined as LOW but still floating in INPUT mode pinMode(X, OUTPUT); // Change the pin to low resistance LOW delay(100); pinMode(X, INPUT); // Return the pin to floating state OR as you suggested, use an NFET to switch it. I will do that! \$\endgroup\$ – DavidCyr2000 Nov 20 '17 at 1:45
1
\$\begingroup\$

Have you considered using a bi-directional 5V/3V3 logic level converter circuit (typically just an appropriately-chosen N-channel MOSFET with a couple pull-up resistors). For example, search for "logic level shifter" on SparkFun.com (e.g., SKU# BOB-12009). The basic design is shown below in Figure 1.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1.

Caveat: The 5V logic's output LOW voltage feeds through the MOSFET unmodified and is applied directly to the 3.3V logic input pin. Note that \$V_{OL}\$ for 5V CMOS logic is 0.9V, while \$V_{IL}\$ for 3V3 logic is 0.8V. However, in many cases, the logic LOW output voltage from the 5V logic side is well below 0.8V, and so this logic level converter circuit works fine for those cases.

\$\endgroup\$
0
\$\begingroup\$

You can definitely do that, but should consider using a diode, it is the cheap level shifter for this situation, moreover it frees you from code error concerns.

\$\endgroup\$
  • \$\begingroup\$ How are you suggesting to connect a diode? \$\endgroup\$ – DavidCyr2000 Apr 12 '18 at 19:24
  • \$\begingroup\$ you add a diode from the external pull-up for 3v3 logic to a digital pin at the 5v logic, so you may only drain current from 3v3 to gnd, never sourcing 5v to it. \$\endgroup\$ – Marcus Meneses Apr 21 '18 at 7:33
  • \$\begingroup\$ Sorry, but you will have to be more specific because I can't visualize what you have described. Thanks! \$\endgroup\$ – DavidCyr2000 Apr 23 '18 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.