Nano CH340 and TM1637

Hi everybody
I am using a Nano V3 CH340 (Chinese)
connect my sketch a TM1637 4 digit module, pines 2 CLK 3 DIO
use Grove 4 digit library and a example from library
well, not working
whitout connect DIO work fine (show nothing, no hangup)
but connect DIO to pin D3 the cpu is hang up and the display show garbage and disconnect USB from pc
the same circuit working very well in a UNO and MEGA cpu
What is the problem??
Thanks

does the behavior appear with blink sketch?

Using from tool bar, post your code.

/*
    TM1637.cpp
    A library for the 4 digit display

    Copyright (c) 2012 seeed technology inc.
    Website    : www.seeed.cc
    Author     : Frankie.Chu
    Create Time: 9 April,2012
    Change Log :

    The MIT License (MIT)

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.
*/

#include "TM1637.h"

// Pins definitions for TM1637 and can be changed to other ports
const int CLK = 6;
const int DIO = 7;
TM1637 tm1637(CLK, DIO);

void setup() {
    tm1637.init();
    tm1637.set(BRIGHT_TYPICAL);//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;

    // LOVE, O=0
    tm1637.displayStr("L0UE");
    delay(2000);

    // loop
    tm1637.displayStr("HELL0-1234567890", 1000);
    delay(2000);

    // ON
    tm1637.displayStr("0N");
    delay(2000);

    // OFF
    tm1637.displayStr("0FF");
    delay(2000);
}

void loop() {
    tm1637.clearDisplay();
    delay(500);
    tm1637.displayStr("d0nE");
    delay(500);
}

What link did you use to download the TM1637.h library?
With my TM1637.h library I was unable to compile your code.

The function gave an error:

" tm1637.displayStr("xxxx"); "
'class TM1637' has no member named 'displayStr'; did you mean 'display'?

https://github.com/Seeed-Studio/Grove_4Digital_Display/tree/master

In the simulator it worked OK.

And...

Your code says " const int DIO = 7; " and not " const int DIO = 3;

yes you are right!
I change pins from example to 2 and 3
try both connections 2/6 and 3/7
the behavior is erratic and show any number and the processor hangup and no receive more USB from pc. (nano not connected)
there only way of charge new program is connect USB and just in time send new sketch

How is everything powered? USB? External power? If the latter, which voltage?

A wiring diagram wirh all connections (including power and GND) might help; photo of hand drawn one is fine.

well. thanks for the answer
I try with USB power and +12v in Vin
with 12v disconnect USB

Captura desde 2023-10-25 11-10-05

If you only power with 12V on Vin, you might very well be overloading the 5V regulator on the Nano which will result in the described behaviour.

I don't think that this will be the case when powering from USB only but I'm not sure; the PC will be the limiting factor (500 mA limit for USB ports).

Note that you power using both the 5V derived from the Vin will win so your board will be powered as described by the first paragraph above.

@kolaha asked a question in the first reply; can you answer that.

Hi everyone!
finally I found the problem, noise in +5v
add a electrolitic capacitor 47uF 25v in vcc.gnd in module TM1637 and the sketch work fine
current of TM1637 full bright is 80mA and the regulator +5v work very cold.
Thanks

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.