Taxi Meter Design: Problems, Solutions, and Progresses

Problem-1: Simultaneous Operation of SPI Port Driven RTC and SPI Port Driven 2xMAX7219 based 16-Digit Display Unit


Figure-1:


Figure-2: Proposed Hardware Block Diagram for ATtiny44 Based Taxi Meter

I am buidling a Taxi Meter (Fig-1, 2) using ATtiny44 MCU which supports SPI or SDA Port (NOT both simultaneously). I need the SPI Port to drive MAX7219 for Display Unit. I would also like to display the time of the day; so, I need a SPI supported RTC chip of minimum pin count.

If you have any idea about that chip, please let me know.

Which one does not? e.g.:

Thank you very much for the information. SPI driven DS3234 has 20-pin and a bit expensive.

I am investigating the case if I can do the multiplex use of I2C Bus service at one time for 8-pin low cost DS1307 RTC and SPI Port service at another time for MAX27219 knowing that I2C/SPI are the alternate functions of PPin-7 (MOSI/SDA) and PPin-9 (SCK/SCL) of ATtiny44 MCU.

DS1307 is I2C, DS1306 is SPI:

Not really - it can be easily bit banged using digital pins if you have some left over in your project.

In fact it can be run from a PCF8574 over I2C - if you are desperate and can take a major performance hit. Not enough memory on an ATtiny44.

And following posts.

Is there any minimm pin count RTC Chip with SPI Port?

That depends on what you want to do.
For SPI You will need power and ground, clock, data in if you are going to tell it anything, data out if it is going to give you anything and if there are other devices chip select to know it is selected. This comes out to 4 - 6 depending on configuration.

I2C is simpler. You need power and ground, data and clock so that comes out to 4 pins needed.

There are other methods where you can get it down to two, example temperature sensors.

ATtiny44 has enough IO line to drive MAX7219 by bit banging. Now, I can handle DS1307 RTC using I2C Bus. I will come back with results soon.

Presently, I am developing the hardware/software using Arduino UNO and a 16 x cc-type standalone display unit being driven by two cascaded MAX721. I will switch over to ATtiny44 once the chips arrive by 3 weeks from Chin.

  • You might be very disappointed in the DS1307 RTC, the DS3231 is far more stable.

PCB space and cost of the product are really concerned. DS3231 is ten times costlier than DS1307. Showing time of the day on the Waiting Time display window of the Taxi Meter is an optional requirement. Time inaccuracy of DS1307 (about 2-sec/day) compare to 0.16-sec/day of DS3231 could be acceptable from practical point of view.

  • I bought 20 for $22.00 plus $7.00 shipping, AliExpress. :thinking:

20 x DS3231 = US$ 22x119 = Tk 2618
==> Tk 130/piece //Tk for Taka is the Currency name of Bangladesh

10 x DS1307 = Tk 136
10 x 32.768 kHz crystal = Tk 150
==> Tk 29/piece

Is the max7219 on a manufactured board containing the 7-seg display, or are you using a standalone max7219 and display? If the latter, maybe you could switch to using HT16K33 which is i2c.

If you intend using this , check you don’t need any approvals , as money is involved , and any dispute could be tricky

16 cc-tpye standalone display devices being driven by two cascaded MAX7219 in the following organization:

(DP0) DP1 - DP5    = Fare Meter (Tk)  //(DP0) means -- device is absent physically
(DP6) DP7 - DP11   = Distance Meter (kM)
DP12 - DP15        = Waiting Time Meter/Time of Day (MS/HM)

Ideal. You can drive all 16 digits with one HT16K33, and share the i2c pins with a ds3231 or ds1307 RTC.

Thanks for the infomation. I have ordered for 28-pin version five pieces and will arrive by 4 weeks from China. Let me have it, program it, and come back here with results/problems.

If I can manage programming the chip and the display intentity level up to satisfaction, then it will be a replacement for 2 x MAX7219 chips.

Problem-1 of post #1 is solved by Bit-bangging scheme (Fig-1, Example of a Distance-drive journey)). It is working fine with Arduino UNO (present Dev Tool). Hopefully, it will also be working with ATtiny44 which is yet to arrive from China.


Figure-1:

The alternate solution could be the use of I2C HT16K33 @PaulRB (post #16), which will be tested once the chip arrives by 3 weeks time from China. If the said chip works for me, then I2C DS1307 and I2C HT16K33 can be operated using SDA/SCL lines. As a result, PB0, PB1, and PB3 (Fig-2 of post #1) will be free and could be emplyed to implement the followig user commands:

W = Perform Wheel Test
K = Prform K Factor Test of the Wheel
W-K =  Perform Error Calculation

I have received the above display controllers in MSOP package. I will have hard time to bring out connections from the tiny pins of the chip..

I would appreciate if you can refer me to a Tutorial using CC-type 7-segment display unit, UNO, and HT16K33. I have searched and have found few which are not complete.

You should buy an HT16K33 module, they are commonly available from the usual outlets. The modules are breadboard compatible.

Maybe try the Adafruit website. But probably no tutorial will describe how to drive 16 digits of CC 7-segment displays.

HT16K33 was originally designed to drive CC 16-seg displays, the type where each digit can show alphabetical characters as well as digits.

You can connect 2x 4-digit 7-seg CC displays as though it was a single 4-digit 16-seg CC display. The cathodes would be connected to the same C0-C3 pins on the chip. One display would be connected to the A0-A7 pins and the second display connected to the A8-A15 pins.