RTC CLOCK on BLUE PILL with Four 7 segments

unuldinei
Sat May 06, 2017 3:44 pm
Hi, recently I finished the mixing ugly code for the multiplexed Four 7 Segments .Cheap and easy way to build this… Just solder directly(!oh, don’t do that! :oops: ) on the STM32 Blue Pill.
Image
“Pasta ingredients and procedure:”
configuration No JTAG !! is in code but
configuration No USB serial !!…
find file usb_serial.cpp and Commented the content of USBSerial::begin like this
void USBSerial::begin(void) {
#if BOARD_HAVE_SERIALUSB
// usb_cdcacm_enable(BOARD_USB_DISC_DEV, BOARD_USB_DISC_BIT);
// usb_cdcacm_set_hooks(USB_CDCACM_HOOK_RX, rxHook);
// usb_cdcacm_set_hooks(USB_CDCACM_HOOK_IFACE_SETUP, ifaceSetupHook);
#endif
}

unuldinei
Mon Jul 03, 2017 5:34 pm
Hello again… a little update with a DS18B20 and new parameter for display…
TDV = 0 to 30 seconds .Time Display Value display alternately clock or temperature(-40*C , +99*C) in 1 to 30 seconds per minute
The DS18B20 is have a pull-up resistor 4K7 (not critical values for short cable).
Image

Pito
Mon Jul 03, 2017 7:56 pm
What is the value of resistors you are using in the display’s anodes?

zmemw16
Mon Jul 03, 2017 8:20 pm
in this age of smd etc, you can still obtain 16 pin DIL housing 8 separate resistors, 1->16, 2->15….8->9 etc & you only need one :D
stephen

unuldinei
Mon Jul 03, 2017 8:37 pm
There is no resistors!(Of course pull-up for DS18B20 sensor must be) All pins of 7 segments LCD is solder directly on blue pill STM32… The software makes everything. Multiplexing and timer fake pwm…

zmemw16
Mon Jul 03, 2017 8:51 pm
the point is there should be.
it would prevent quite possibly exceeding the combined mA limit for the chip.
it would also work towards unifying the display segments intensity.
stephen

Pito
Mon Jul 03, 2017 8:59 pm
That is why I asked :) There have to be resistors in the anodes otherwise you overload the STM32’s max output current, sure.
It may work for some time, but it is definitely wrong approach (not to use the anode’s resistors, 8 pcs.).
Long time back I did it in a following way:
1. when not multiplexing the segments, choose R1-8 such the display segments lit normally (ie. 3mA current per segment needed, thus the resistors = (3.3V-1.6V)/0.003A = 566ohm)
2. when multiplexing 4 digits, the 8 resistors (7 segments + dot) shall be 566/4 = ~150ohm each..
Or something like that.

unuldinei
Mon Jul 03, 2017 9:22 pm
Pay atention to pins when you solder the LCD and if you want ,my friend, put a 120…220 Ohm Resistors on the dig1, dig2, dig3,dig4 pins. I also experimented with Arduino Mini in the past. Everything works ok many months for now. Why? Because is a neutral times between the spike.
The next step is a relay and buttons.
An old project [youtube]https://www.youtube.com/watch?v=fLRitUlOkIY[/youtube].
Thanks for read my ugly project…sincerely!

ag123
Tue Jul 04, 2017 6:27 am
i’d guess stm32f103 can take quite a bit of abuse (with leds), i simply lit up my ILI9341 lcd backlight led with a gpio pin across a 900 ohm on board resistor
but for 7 segment leds, it is better to be safe and add some resistors perhaps, otherwise 1’d likely be playing dice with the magic smoke monster
it seemed in this case it is somewhat ‘safe’ as the multiplexing makes it works like some sort of pwm preventing too much heat build up on the stm32
:lol:

Pito
Tue Jul 04, 2017 8:36 am
FYI – maybe worth of placing on the wiki:
from STM32F103C8 datasheet (MapleMini, BluePill and others):
DocID13587 Rev 17 page 65/117 – Electrical characteristics

Output driving current

The GPIOs (general-purpose inputs/outputs) can sink or source up to ±8mA, and sink or source up to ±20mA (with a relaxed VOL/VOH) except PC13, PC14 and PC15 which can sink or source up to +/-3mA. When using the GPIOs PC13 to PC15 in output mode, the speed should not exceed 2 MHz with a maximum load of 30 pF.

In the user application, the number of I/O pins which can drive current must be limited to respect the absolute maximum rating specified in Section 5.2 :
• The sum of the currents sourced by all the I/Os on VDD, plus the maximum Run consumption of the MCU sourced on VDD, cannot exceed the absolute maximum rating IVDD [150mA] (see Table 7).
• The sum of the currents sunk by all the I/Os on VSS plus the maximum Run consumption of the MCU sunk on VSS cannot exceed the absolute maximum rating IVSS [150mA] (see Table 7).


zmemw16
Tue Jul 04, 2017 10:23 am
@Pito
2. when multiplexing 4 digits, the 8 resistors (7 segments + dot) shall be 566/4 = ~150ohm each..
Or something like that.

would you like to re-think that ?
multiplex – drive one at a time, fast enough that they don’t flicker.
stephen

Pito
Tue Jul 04, 2017 10:28 am
Why???
Thinking makes me a big pain.. :roll:
The common cathodes (4 in this case) require an external switch as well – the max current in particular common cathode will be 8x I_per_segment, which is also off the limits, sure..

zmemw16
Tue Jul 04, 2017 10:37 am
the displays all use the same digital drives A-F & dot.
the displays are multiplexed, so only one is active at a time.
stephen

Pito
Tue Jul 04, 2017 10:42 am
@stephen: but mind in static mode a digit will be continually “on” (ie all 8 segments), but in muxed mode and 4 digits the active digit’s segments will be “on” only for 1/4 of the time (approximately, the overhead not counting here) thus you need ~4x bigger current per segment to achieve the same “visual brightness” as in the static mode – therefore the 8 anode’s resistors (we talk here the common cathode setup) have to be 4x smaller (again not considering the nonlinear ratio of the LED’s brightness/current).. ;)

And of course you need external switches for the common cathodes (ie low side npn transistor or nfet) as the currents of the active segments sum up and worst case the cathode current of the particular digit will be 8x Isegment, way off the stm32 current limit.

PS: the popular MAX7219 does not require resistors in the segments as it uses a “current source” in the segments (and those currents are programmable). That is a different scenario to our stm32 as the stm32 does not possess such a “current sourcing” capability.


zmemw16
Tue Jul 04, 2017 4:03 pm
what static mode ? who mentioned static ?
oh, for setting the clock, increase the pwm for the current digit and decrease it for the other digits.
bright for the digit being set, dimmed down for the rest.
stephen

fredbox
Tue Jul 04, 2017 10:44 pm
The easy way to get a small 4 digit 7-segment clock display is to use one of the TM1637 modules from Ali or eBay. Two data lines, power and ground, a small amount of code and you are good. These displays are simple enough that you can bit-bang without a library – see this example.

If you need 8 digits, there are plenty of inexpensive MAX7219 seven segment modules.

But I will agree that it’s fun to wire the individual displays and write the code to make it work.


unuldinei
Mon Jul 24, 2017 6:01 pm
Yeah, there are many ways to light a 7 segments LCD and thanks for all the good advice !

Now Luckylight is on the table…
LUCKYLIGHT KW4563ASA COMMON ANODE
No special modification of USB library requirement just cancel the jtag function
One rows of pins solder directly to the pcb
DS18B20 senzor display
HMI on serial USB maple port, check HMI with +++ ;
DFU still not working well
TDV Time to alternate display clock or temperature in EEPROM, value 1-30 seconds
Link to new version of this RTC CLOCK :
https://drive.google.com/drive/folders/ … sp=sharing

Image


Leave a Reply

Your email address will not be published. Required fields are marked *