Display for Stackmat timer

Hi. I want create DISPLAY for Stackmat timer for Rubiks Cube.

It use 2.5 audio jack and 3.5.for computer where is microfon separete from headplugs jack.


I will go with:

  • TM1637 6-digit display(0.56"),
  • Arduino Nano,
  • Audio jack attached to arduino.

It working with pulses which sending from timer? Is that hard to do with code?

I found some examples, but not for 1637, found for MAX7219.

Main example:

Other examples:

http://robojax.com/node/1295

According to a link on the page you linked to:

The "stackmat signal" is essentially just a RS232 serial signal (1200 baud, 8 databits, no parity bits, one stop bit). This signal is converted to TTL level (5V/0V) by the MAX232 level shifter IC, so the Atmel microprocessor can understand it.

The payload is transmitted in 9 byte packets:
1: command byte as ASCII character ('I','A','S','L','R','C' or ' ')
2-6: time in ASCII chars (2:34:56)
7: checksum (64 + sum of time digits)
8: CR (carriage return, ASCII code 0x0D)
9: LF (line feed, ASCII code 0x0A)
Example:
S02527P[CR][LF]
time: 0:25:27
checksum: 64 + 0 + 2 + 5 + 2 + 7 = 64 + 16 = 80 = 'P' (chechsuk OK)
Command bytes:
'I': timer initialized and reset to 0 (both hand pads open)
'A': timer ready to begin, both hand-pads covered
' ': timer running/counting (both hand-pads open)
'S': timing complete (both hand-pads open)
'L': left hand-pad covered (overrides 'I', ' ', 'S')
'R': right hand-pad covered (overrides 'I', ' ', 'S')
'C': both hand-pads covered (overrides 'I', ' ', 'S')

I would suggest to begin using a software serial library to read the data from the timer and echo it to serial monitor. When you have that working, you can think about updating your display.

1 Like

Ok. In two weeks of searching and testing, I will write this post in as much detail as possible.

Before I start, please see this link: LINK . It says that not working with YUXIN timer (which is mine), and I am not sure is that says for Arduino project or some other project.

Working in ledmat.ino Sketch.

Displays

Good news that I remembered that I had 3x Max 7219 modules at home, so I connect 2 of them to play safe first. And if I managed, then I can switch to TM1637. Right?

Librarys

First original MD_Parola-master and MD_MAX72XX-master not worked for me. So, the best results gived me a downloaded MD_MAX72XX-main + MD_Parola (downloaded directly from arduino library ver. 3.5.6.).

Problem with Librarys - rotating letters // Hardware SPI connection

On old MD_MAX72XX.h was easy to change, like

#define USE_PAROLA_HW 0
#define USE_FC16_HW 1

But on new one is are defferent, and all lines are in same place, don't know how change this.. It's only says <USE, but use where!?

    GENERIC_HW,   //< Use 'generic' style hardware modules commonly available.
    FC16_HW,      //< Use FC-16 style hardware module.
    PAROLA_HW,    //< Use the Parola style hardware modules.
    ICSTATION_HW, //< Use ICStation style hardware module.

So I figure out and resolve that from other Parola example. In ledmat.ino skectch I added

#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
and change from:
MD_Parola P = MD_Parola(CS_PIN, MAX_DEVICES);
to:
MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);

That gives me results like on picture bellow. Display ready to show numbers (dots and colon show).

Serial comunication success

At first, when I run ledmat.ino and Serial Monitor, nothin happened. Then I found this code for serial, which was bellow in some loop. I copy it and paste at the top of the code (in void setup, just after Serial Begin).

m2=micros();
toggle=1;
return;
Serial.print(String(arr[i])+"-"); //that was turned off originaly

Then I run Serial Monitor, and whoola, data shows! Not sure is that the right way, but data change when press or turning timer.

Timer is OFF
23:20:55.603 -> 
23:20:55.650 -> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

TURNING TIMER ON- (previsos Time stay and show on timer '0:11.492')
23:23:10.970 -> 100110101011110011010111001101011100110111010011010110001001011001101011101010110101111010
23:23:11.111 -> 100110101011110011010111001101011100110111010011010110011011011001101011101010110101111010
23:23:11.252 -> 100110101011110011010111001101011100110111010011010110001001011001101011101010110101111010
23:23:11.392 -> 100110101011110011010111001101011100110111010011010110001001011001101011101010110101111010

RESET COUNTER to 0:00.000 /TIMER ON
23:24:22.132 -> 100110101011110011011111001101111100110111110011011111001011111001101111111010110101111010
23:24:22.273 -> 100110101011110011011111001101111100110111110011011111001001111001101111111010110101111010
23:24:22.414 -> 100110101011110011011111001101111100110111110011011111001001111001101111111010110101111010
23:24:22.523 -> 100110101011110011011111001101111100110111110011011111001001111001101111111010110101111010
23:24:22.664 -> 100110101011110011011111001101111100110111110011011111001001111001101111111010110101111010

START COUNTING
23:25:19.344 -> 100110101011110011011111001101101100110101110011011101001011101001101001011010110101111010
23:25:19.484 -> 100110101011110011011111001101101100110110110011011000011001101001101100011010110101111010
23:25:19.641 -> 100110101011110011011111001101101100110100110011010110011010011001101011101010110101111010
23:25:19.734 -> 100110101011110011011111001101101100110101010011011010011011011001101001011010110101111010
23:25:19.875 -> 100110101011110011011111001101101100110110010011010100001010111001101100011010110101111010
23:25:20.016 -> 100110101011110011011111001101101100110100010011011110001011111001101011101010110101111010
23:25:20.125 -> 100110101011110011011111001101101100110101100011011111001000110001101110101010110101111010
23:25:20.266 -> 100110101011110011011111001101001100110111110011010011001011110001101100011010110101111010
23:25:20.406 -> 100110101011110011011111001101001100110101110011011001001000001001101011101010110101111010
23:25:20.516 -> 100110101011110011011111001101001100110110110011010110001001001001101110101010110101111010
23:25:20.656 -> 100110101011110011011111001101001100110111010011010111001001001001101100011010110101111010
23:25:20.750 -> 100110101011110011011111001101001100110101010011011100001010101001101011101010110101111010
23:25:20.922 -> 100110101011110011011111001101001100110110010011010000001011101001101110101010110101111010

STOP TIMER (Time show 0:14.319)
23:25:43.922 -> 100110101011110011010111001101110100110100110011010111001010101001101100011010110101111010
23:25:44.063 -> 100110101011110011010111001101110100110100110011010111001000101001101100011010110101111010
23:25:44.172 -> 100110101011110011010111001101110100110100110011010110001000101001101100011010110101111010
23:25:44.313 -> 100110101011110011010111001101110100110100110011010110001000101001101100011010110101111010
23:25:44.453 -> 100110101011110011010111001101110100110100110011010111001000101001101100011010110101111010

TURN OFF TIMER
23:27:49.413 -> 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
23:27:49.522 -> 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
23:27:49.616 -> 111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000

Conclusion

Serial communication working, but not showing a number on display. Maybe is reason because this serial code must working at the bottom and show data from there, but not showing. Or maybe reason I set just 2 displays, and need 5x. Maybe need another pin change (one weeks I needed to figure out that pin 12 not working, and 13 working for CLK!!).
Or just don't working on my Yuxin timer, but I don't think so.

It seems I am so close now.

You do not seem to have followed my suggestion about using software serial.

#include <SoftwareSerial.h>

SoftwareSerial yuxin(10, 11);

void setup() {
  Serial.begin(115200);
  yuxin.begin(1200);
}

void loop() {
  while (yuxin.available() > 0) {
    char inByte = yuxin.read();
    Serial.write(inByte);
  }
}

Try this and post what you see on serial monitor. (Do not post screen captures of serial monitor. Copy the text from serial monitor and paste it into your reply between code tags.) Replace "10" with the pin you have connected to the yuxin. Replace the "11" with some other pin that is not used.

Ok, I set pins (2,11), and receive just all kind of characters.
Can't copy all data in row, just part by part (I selected all, but copy only like 9 characters).
Do we looking here 0 and 1 ? I try change some bauds and pins, but no zeros and ones in serial.

//Timer ON, Timer show 0:000 :
V⸮⸮⸮⸮⸮⸮⸮⸮ V⸮⸮⸮⸮⸮⸮⸮⸮  

//Timer counting:
VV6v⸮⸮I⸮⸮
VV֍⸮⸮I⸮⸮
Vg⸮⸮֛e⸮⸮
6V6⸮⸮
Vg⸮V⸮⸮Y⸮⸮
Vgv⸮֟_⸮⸮
V⸮⸮v⸮66⸮⸮
V⸮⸮VvVֵ⸮
V⸮⸮6vv⸮⸮
V⸮⸮֙S⸮⸮
V⸮⸮֛⸮_⸮⸮

Did you change the serial monitor baud rate to 115200?

We are hoping to see lines like this

S02527P

Yes. All time is on that baud. Sometimes when change baud got this 흝, think is Chinnese character :slight_smile:

Also I have two ardoinos. I try with Mega, but nothing.

On nano using AtMega328P(OldBootloader).

Maybe something is with alphabet in my computer? Maybe need something install, new SoftwareSerial or something? Maybe reason my chinnese arduinos? (but who not have it?).

Try a lower baud rate and print some simple text to check serial monitor is working.

void setup() {
  Serial.begin(9600);
  Serial.println("Can you read this on serial monitor?");
  yuxin.begin(1200);
}

void loop() {
  while (yuxin.available() > 0) {
    char inByte = yuxin.read();
    Serial.print("<");
    Serial.print(inByte);
    Serial.print("> ");
    Serial.println(inByte, BIN);
  }
}

I tested read words in serial before that, and words worked fine.

(Your baud settings I will write like 9600/1200)
Here is with new code:

//TURNED ON, TIME 0.000
Can you read this on serial monitor?
<V> 1010110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111110101101
<⸮> 11111111111111111111111111100101
< > 0
<V>1010110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111110101101
<⸮> 11111111111111111111111111100101

//COUNTER ON:
<V> 1010110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111111110110
<V> 1010110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111111010110
<⸮> 11111111111111111111111111110110
<V> 1010110
<⸮> 11111111111111111111111111110110
<V> 1010110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111110101101
<V> 1010110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111110101101
<V> 1010110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111110101101
<V> 1010110
<V> 1010110
<⸮> 11111111111111111111111111110110
<⸮> 11111111111111111111111110101101
<V> 1010110
<⸮> 11111111111111111111111111110110
<V> 1010110
<⸮> 11111111111111111111111111110110

I try on 9600/300, and got this:

9600/300

<r> 1110010
<?> 111111
<> 101
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111110110001
<r> 1110010
<K> 1001011
<r> 1110010
<⸮> 11111111111111111111111111100011
<r> 1110010
<⸮> 11111111111111111111111110101110
<a> 111
<r> 1110010
<I> 1001001
<a> 111
<r> 1110010
<r> 1110010
<5> 110101
<2> 110010
<⸮> 11111111111111111111111111110001
<2> 110010
<⸮> 11111111111111111111111111110001
<2> 110010
<	> 1001
<2> 110010
<2> 110010
<⸮> 11111111111111111111111111110011
<a> 111
<2> 110010
<> 1011
<a> 111
<2> 110010
<⸮> 11111111111111111111111110100001
<a> 111
<2> 110010
<2> 110010
<⸮> 11111111111111111111111111010000
<2> 110010
<⸮> 11111111111111111111111110100001
<2> 110010
<2> 110010
<2> 110010
<⸮> 11111111111111111111111110110011
<a> 111
<2> 110010
<2> 110010
<W> 1010111
<> 101
<2> 110010
<⸮> 11111111111111111111111110110001
<a> 111
<r> 1110010
<⸮> 11111111111111111111111111111001
<> 101
<r> 1110010
<⸮> 11111111111111111111111111100011
<r> 1110010
<⸮> 11111111111111111111111110100011
<r> 1110010
<⸮> 11111111111111111111111111101110
<r> 1110010
<⸮> 11111111111111111111111111110011
<a> 111
<r> 1110010
<K> 1001011
<a> 111
<r> 1110010
<> 11111
<r> 1110010
<⸮> 11111111111111111111111111100001
<r> 1110010
<⸮> 11111111111111111111111111011001
<r> 1110010
<> 1011
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111111100100
<a> 111
<r> 1110010
<⸮> 11111111111111111111111111110001
<a> 111
<r> 1110010
<⸮> 11111111111111111111111111100001
<r> 1110010
<> 11111
<r> 1110010
<a> 111
<2> 110010
<⸮> 11111111111111111111111110110011
<a> 111
<I> 1001001
<2> 110010
<⸮> 11111111111111111111111111110011
<a> 111
<2> 110010
<⸮> 11111111111111111111111110100110
<2> 110010
<K> 1001011
<a> 111
<2> 110010
<2> 110010
<?> 111111
<2> 110010
<⸮> 11111111111111111111111111111001
<2> 110010
<⸮> 11111111111111111111111111100011
<2> 110010
<K> 1001011
<2> 110010
<⸮> 11111111111111111111111110110011
<a> 111
<2> 110010
<⸮> 11111111111111111111111111110001
<2> 110010
<K> 1001011
<a> 111
<2> 110010
<=> 111101
<> 101
<r> 1110010
<⸮> 11111111111111111111111111011001
<a> 111
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111110101110
<r> 1110010
<a> 111
<r> 1110010
<	> 1001
<a> 111
<r> 1110010
<q> 1110001
<a> 111
<⸮> 11111111111111111111111110110001
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111111110001
<a> 111
<r> 1110010
<⸮> 11111111111111111111111110110011
<r> 1110010
<⸮> 11111111111111111111111111100110
<r> 1110010
<r> 1110010
<K> 1001011
<a> 111
<r> 1110010
<r> 1110010
<c> 1100011
<a> 111
<r> 1110010
<⸮> 11111111111111111111111111011001
<r> 1110010
<⸮> 11111111111111111111111111100001
<a> 111
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111111101100
<a> 111
<⸮> 11111111111111111111111111110011
<r> 1110010
<⸮> 11111111111111111111111110110001
<a> 111
<r> 1110010
<7> 110111
<> 101
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111110110011
<r> 1110010
<I> 1001001
<r> 1110010
<⸮> 11111111111111111111111111110001
<r> 1110010
<⸮> 11111111111111111111111110100100
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111111110001
<a> 111
<r> 1110010
<7> 110111
<> 101
<r> 1110010
<⸮> 11111111111111111111111110110001
<2> 110010
<⸮> 11111111111111111111111111110011
<a> 111
<2> 110010
<2> 110010
<⸮> 11111111111111111111111110110001
<a> 111
<2> 110010
<⸮> 11111111111111111111111111110011
<a> 111
<2> 110010
<	> 1001
<a> 111
<2> 110010
<a> 111
<2> 110010
<2> 110010
<⸮> 11111111111111111111111111011000
<> 101
<⸮> 11111111111111111111111110110011
<2> 110010
<2> 110010
<⸮> 11111111111111111111111110100110
<a> 111
<2> 110010
<⸮> 11111111111111111111111110110011
<a> 111
<2> 110010
<> 1011
<a> 111
<2> 110010
<2> 110010
<⸮> 11111111111111111111111110110001
<r> 1110010
<⸮> 11111111111111111111111111111001
<r> 1110010
<⸮> 11111111111111111111111110110001
<r> 1110010
<K> 1001011
<r> 1110010
<r> 1110010
<r> 1110010
<I> 1001001
<a> 111
<r> 1110010
<> 10111
<> 101
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111111010001
<> 101
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111110110011
<r> 1110010
<⸮> 11111111111111111111111111100100
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111111100011
<a> 111
<r> 1110010
<> 11111
<> 101
<r> 1110010
<2> 110010
<> 101
<2> 110010
<K> 1001011
<a> 111
<a> 111
<2> 110010
<⸮> 11111111111111111111111110101100
<2> 110010
<K> 1001011
<2> 110010
<⸮> 11111111111111111111111111110001
<a> 111
<2> 110010
<?> 111111
<> 101
<2> 110010
<⸮> 11111111111111111111111110110011
<2> 110010
<2> 110010
<I> 1001001
<a> 111
<2> 110010
<a> 111
<2> 110010
<2> 110010
<I> 1001001
<a> 111
<2> 110010
<⸮> 11111111111111111111111110110001
<a> 111
<2> 110010
<r> 1110010
<⸮> 11111111111111111111111111011000
<r> 1110010
<⸮> 11111111111111111111111110110001
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111111110001
<a> 111
<r> 1110010
<⸮> 11111111111111111111111110110011
<a> 111
<r> 1110010
<> 1011
<a> 111
<r> 1110010
<a> 1100001
<a> 111
<r> 1110010
<a> 111
<r> 1110010
<⸮> 11111111111111111111111111110000
<r> 1110010
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111111101110
<a> 111
<r> 1110010
<r> 1110010
<I> 1001001
<a> 111
<r> 1110010
<> 11111
<> 101
<r> 1110010
<⸮> 11111111111111111111111111110001
<a> 111
<r> 1110010
<⸮> 11111111111111111111111111011000
<> 101
<b> 1100010
<⸮> 11111111111111111111111111100011
<a> 111
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111111100110
<a> 111
<r> 1110010
<⸮> 11111111111111111111111111100011
<a> 111
<r> 1110010
<r> 1110010
<?> 111111
<> 101
<r> 1110010
<⸮> 11111111111111111111111111110001
<a> 111
<r> 1110010
<⸮> 11111111111111111111111111011001
<> 101
<r> 1110010
<K> 1001011
<r> 1110010
<⸮> 11111111111111111111111111110011
<a> 111
<b> 1100010
<r> 1110010
<⸮> 11111111111111111111111110100011
<r> 1110010
<⸮> 11111111111111111111111111100001
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111110110001
<a> 111
<2> 110010
<a> 111
<2> 110010
<	> 1001
<a> 111
<2> 110010
<⸮> 11111111111111111111111110110011
<a> 111
<2> 110010
<⸮> 11111111111111111111111111101110
<a> 111
<2> 110010
<2> 110010
<⸮> 11111111111111111111111110110011
<a> 111
<2> 110010
<2> 110010
<a> 1100001
<a> 111
<"> 100010
<⸮> 11111111111111111111111110100011
<a> 111
<2> 110010
<> 1011
<a> 111
<2> 110010
<⸮> 11111111111111111111111111110011
<2> 110010
<2> 110010
<> 1011
<a> 111
<2> 110010
<"> 100010
<> 10101
<> 101
<r> 1110010
<> 101
<r> 1110010
<r> 1110010
<K> 1001011
<a> 111
<r> 1110010
<⸮> 11111111111111111111111111100110
<a> 111
<r> 1110010
<b> 1100010
<I> 1001001
<a> 111
<⸮> 11111111111111111111111110110001
<r> 1110010
<⸮> 11111111111111111111111111110011
<a> 111
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111111110001
<a> 111
<b> 1100010
<r> 1110010
<⸮> 11111111111111111111111111101110
<b> 1100010
<⸮> 11111111111111111111111111110011
<r> 1110010
<r> 1110010
<> 11111
<> 101
<r> 1110010
<⸮> 11111111111111111111111110100011
<a> 111
<2> 110010
<⸮> 11111111111111111111111111110000
<"> 100010
<⸮> 11111111111111111111111110110001
<a> 111
<"> 100010
<2> 110010
<⸮> 11111111111111111111111110100100
<a> 111
<2> 110010
<⸮> 11111111111111111111111110100011
<2> 110010
<⸮> 11111111111111111111111111110001
<a> 111
<2> 110010
<7> 110111
<2> 110010
<⸮> 11111111111111111111111110110001
<"> 100010
<⸮> 11111111111111111111111111110011
<a> 111
<2> 110010
<I> 1001001
<2> 110010
<⸮> 11111111111111111111111110100011
<a> 111
<2> 110010
<⸮> 11111111111111111111111110101100
<a> 111
<"> 100010
<K> 1001011
<a> 111
<2> 110010
<⸮> 11111111111111111111111110110001
<a> 111
<2> 110010
<7> 110111
<> 101
<"> 100010
<q> 1110001
<r> 1110010
<⸮> 11111111111111111111111110110011
<a> 111
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111111110011
<b> 1100010
<⸮> 11111111111111111111111110110011
<r> 1110010
<	> 1001
<r> 1110010
<a> 1100001
<a> 111
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111111110000
<b> 1100010
<r> 1110010
<I> 1001001
<a> 111
<r> 1110010
<⸮> 11111111111111111111111111101110
<r> 1110010
<⸮> 11111111111111111111111111110001
<a> 111
<K> 1001011
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111111110001
<a> 111
<b> 1100010
<r> 1110010
<⸮> 11111111111111111111111111100011
<a> 111
<r> 1110010
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111111110001
<a> 111
<b> 1100010
<K> 1001011
<r> 1110010
<7> 110111
<r> 1110010
<⸮> 11111111111111111111111111110001
<r> 1110010
<⸮> 11111111111111111111111111011001
<> 101
<r> 1110010
<r> 1110010
<⸮> 11111111111111111111111111110011
<r> 1110010
<⸮> 11111111111111111111111110101100
<a> 111
<r> 1110010
<⸮> 11111111111111111111111110100001
<a> 111
<a> 111
<r> 1110010
<7> 110111
<> 101
<r> 1110010
<⸮> 11111111111111111111111110110001
<a> 111
<2> 110010
<2> 110010
<> 1011
<a> 111
<2> 110010
<2> 110010
<⸮> 11111111111111111111111111100100
<2> 110010
<> 1011
<2> 110010
<⸮> 11111111111111111111111110110001
<a> 111
<"> 100010
<> 11111
<> 101
<2> 110010
<2> 110010

On 9600/2400, i get more of "f "and "x".

It's very strange. There are patterns but I can't relate them to the data we are expecting from the link in your first post.

At least we know that serial monitor is working ok, although if that was not true, you would not be able to upload your sketch! You can go back to using 115200 for serial monitor from now on.

Maybe try this:

  Serial.begin(115200);
  yuxin.begin(1200, true);

The "true" parameter tells the software serial library to invert the signal.

Not valid :frowning: Return me this:

Using library SoftwareSerial at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial
exit status 1
no matching function for call to 'SoftwareSerial::begin(int, bool)'

You will better understand this video I found.

If I understand him, his timer have inverted signal. Going on 2 volts, and he adapted it like standard NPN trasistor circuit.

Sorry!

SoftwareSerial yuxin(10, 11, true);
...
  yuxin.begin(1200);
1 Like

Yes, the video is useful. If my last suggestion does not work, you could try the transistor circuit suggested in the video.

However, the stackmat timer in the video is a different brand and design to your to yuxin timer. If none of these suggestions work, you may need to connect your timer to an oscilloscope to analyse the signal and understand the format it uses. This will require some expertise with an oscilloscope.

Great ! :smiley: After I saw it is better now, I copied that in your first code. And it seems it works.
Timing is ok.
Not sure yet which baud is better for use.
And not sure it is " Command bytes:" working (left hand, booth hands...).
I always see "S" at front.

Here are results on baud serial 9600 / yuxin1200.

⸮⸮)
S000000⸮⸮
S0000⸮0@
S000000@
S00⸮000@
S000000@
S000000@
S0⸮000⸮@
S000000@
S000000@
S⸮00000@
S00⸮000@
S000⸮00@
S000000@
S000000⸮
S000057L
S000149N
S000278Q
⸮S000407⸮
S000536N
S000665Q
S000794T
S000923N
⸮S001052H
⸮S0⸮1181K
S⸮⸮1301E
S001430H
S001559T
S001688W
S001⸮1⸮Q
⸮S001946T⸮
S002075N
S002204H
S002333K
S002453N
⸮002582Q
⸮S002711⸮
S00284⸮N
S002969Z
S0030⸮8⸮
S003227N
S003356Q
S003485T
s⸮03605N
S0037⸮4Q
S003863T
S003992W
S004121H
S004250K
S04379W⸮
s004508Q
S004637T
S0⸮4757W
⸮004886Z
S005015K
S005144N
S00527⸮Q
S005⸮02K
S05531N
S005660Q
S005789]
S005909W
⸮006038Q
⸮S006167Ԋ
S006296W
S006425Q
S006554T
S00⸮683W
S006812Q
S006941T
S007061N
S007190Q
S007319T
S007448⸮
⸮S007577Z
S007706T
S⸮07835W
S007964Z
S008093T
S008213N⸮
S⸮08342Q
⸮S008471T
S008600N
S008729Z
S008⸮⸮8]
S00⸮987`
⸮S009116Q
S009245T
S⸮09365W
S009494Z
S009623⸮
S009752W
S009881Z
⸮010⸮10B
S010139N
S010268Q⸮
S010397⸮
⸮S010517⸮
S⸮106⸮⸮Q
S010775T
S0109⸮4N
S011033H
S01116⸮K
S011291N
S011⸮20H
S⸮1⸮⸮49T
S0116⸮9W
⸮S011798Z
S01⸮927T
S012056N
S012185Q
S012314K
⸮S012⸮⸮5N
⸮S0124⸮⸮Ί
S012425N
S0⸮2425N
S012425N⸮
S⸮12425N
S0⸮2425⸮
S012⸮25N
S012425N
S01⸮4⸮5N
S0122⸮N
S012425⸮
S012425N
Ӱ124⸮⸮N
S0⸮242⸮N⸮
S012425N
S01⸮⸮25N
S012425N
S012425N
S01242⸮N
S01⸮4⸮5N
S01⸮425N⸮
⸮012425N
S0⸮2425N
S⸮12⸮25N
S⸮12425N
S012425N

Final time on timer is: 0:12.425.

This is good progress, well done.

I think we can now be certain that 1200 is correct for the yuxin timer. The baud between the Arduino and the pc can be much faster, I suggest 115200.

But the data that is being received is far from perfect. There are frequent random characters appearing: blocks and other unexpected characters. I think this is because the signal from the timer is only 2~3V because of the 2xAAA battery powering the timer. The Arduino is expecting a 5V signal and this is causing it to incorrectly read some of the data bits.

I think you should follow the advice in the video about using a transistor to boost the data signal. This should stop the random characters appearing. It will have the side-effect of inverting the signal, but that can be easily fixed by changing the "true" to "false" in the SoftwareSerial() line in the code.

Then I will need little help.
Can I do that with 2 resistors only? One 10kΩ going between timer and arduino?

4.7kΩ will go later between battery and arduino? Because now my arduino power is from computer USB.

Q1 and BC546BP don't know what is, assuming that go to the display.

Yes

No, between the timer and the transistor's base pin.

It goes between 5V and the Arduino input pin.

EDIT: you might not need that resistor, if you set the input pin to INPUT_PULLUP.

That's the transistor. It probably does not have to be that exact part, any general purpose npn transistor would be fine, such as bc337.

1 Like

I used BC337 transistor and connected Emitter pin to Ground, Collector pin to Arduino D2 and Base pin to Transistor 10KΩ which go to audio connector TIP pin. Arduino is connected on PC USB, for now.
In code I replace true with false. The whole code is here:

#include <SoftwareSerial.h>

SoftwareSerial yuxin(2,11,false);   // RX, TX
void setup() {
  Serial.begin(115200);
  yuxin.begin(1200);
}
void loop() {
  while (yuxin.available() > 0) {
    char inByte = yuxin.read();
    Serial.write(inByte);
  }
}

LOL
It is now clear enough? :stuck_out_tongue:
(Test on counting 11.577 seconds).

S000000@
S000000@
S000000@
S000000@
S000000@
S000000@
S000000@
S000000@
S000000@
S000000@
S000000@
S000000@
S000000@
S000000@
S000000@
S000005E
S000134H
S000263K
S000392N
S000521H
S000650K
S000779W
S000899Z
S001028K
S001157N
S001286Q
S001415K
S001544N
S001673Q
S001802K
S001931N
S002051H
S002180K
S002309N
S002438Q
S002567T
S002696W
S002825Q
S002954T
S003083N
S003203H
S003332K
S003461N
S003590Q
S003719T
S003848W
S003977Z
S004106K
S004235N
S004355Q
S004484T
S004613N
S004742Q
S004871T
S005000E
S005129Q
S005258T
S005387W
S005507Q
S005636T
S005765W
S005894Z
S006023K
S006152N
S006281Q
S006410K
S006539W
S006659Z
S006788]
S006917W
S007046Q
S007175T
S007304N
S007433Q
S007562T
S007691W
S007811Q
S007940T
S008069W
S008198Z
S008327T
S008456W
S008585Z
S008714T
S008843W
S008963Z
S009092T
S009221N
S009350Q
S009479]
S009608W
S009737Z
S009866]
S009995`
S010115H
S010244K
S010373N
S010502H
S010631K
S010760N
S010889Z
S011018K
S011147N
S011267Q
S011396T
S011525N
S011577U
S011577U
S011577U
S011577U
S011577U
S011577U
S011577U
S011577U
S011577U
S011577U
S011577U
S011577U
S011577U
S011577U
1 Like

That looks great now, I don't see any random characters. You should post your latest code and schematic so we can check them.

Did your TM1637 display arrive yet? Do you want to progress to using that next?

If not, you should be ok with 3x 8x8 matrix, but it will be more complex. It might be possible to display 6 digits, bit there would be no room for ":" or "." as well.