JY-MCU 3208 – Simple clock & ADC

I got this relatively cheap LED matrix panel from Dealextreme. It is a 32 x 8 LED matrix with an on-board ATMEGA8 micro and HT1632C controller. The board also includes ISP connector, DC jack, 3 SMT buttons and cheappy  crystal oscillator.

The schmatics can be found here. There are many parts not mounted, including the USB connector, buzzer and real time clock. This board is definitely begging to be hacked and upgraded.  Rick upgraded the micro to ATMEGA328P-AU.

  

If you planning to buy one of these, please be aware that there is no voltage regulator on board. This board can only be powered on 5V via the DC jack or can be powered via the ISP connector.

Ok, for my simple hack, I added a potentiometer and connect the mid point to the ADC1 pin on the micro. The other two points of course are connected to VCC and GND. Then, I programmed the code to simply read the ADC value display it in counts or move a point from left (for min value) to the right (for the max value).

My code was an extension from various sources: Dr Jones, Damien-hackadl, and Lets make robots. Below are the code snippets. Post a comment below if you want the full code.

C Code – Rendering functions

void renderclock(void)
{
   byte col=0;
   for (byte i=0;i   leds[col++]=0;
   for (byte i=0;i   leds[col++]=0;
   if (sec%2)
   {
       leds[col++]=0x66;leds[col++]=0x66;
   }
   else
   {
        leds[col++]=0;
        leds[col++]=0;
   }
   leds[col++]=0;
   for (byte i=0;i   leds[col++]=0;
   for (byte i=0;i6) +((sec>13)<20)<26)<33)<40)<46)<53)< 3;
	for (byte i = 0; i < 32; i++) leds[col++] = 0; 	leds[number] = 0x01; } void renderADCToDot(uint8_t number) { 	byte col=0; 	number = number >> 3;
	for (byte i = 0; i < 32; i++) leds[col++] = 0;
	leds[number] = 0x01;
}

C Code – Main function

int main(void)
{
  char buffer[4];
  char mode = key1;

  HTpinsetup();
  HTsetup();
  keysetup();
  clocksetup();

  /* Initialize ADC */
  init_adc();

  sei();               //enable interrupts
  for (byte i=0;i  hour=7;minute=40;

  while(1)
  {
		/* Request ADC value update */
		status_bits |= _BV(SB_ADC_READ);

		/* Wait until we get fresh values */
		while(status_bits & _BV(SB_ADC_READ));

		//utoa(adc_values[0], buffer, 10);
		if(key1) mode = 1;
		else if(key2) mode = 2;
		else if(key3) mode = 3;

		if (mode == 1)
		{
			if(clockhandler()) { renderclock(); HTsendscreen(); }
		}
		else if (mode == 2)
		{
			renderADCToDot(adc_values[1]);
			 HTsendscreen();
		}
		else if (mode == 3)
		{
		     renderADCToNumber(adc_values[1]);
			 HTsendscreen();
		}
  }
  return(0);
}
This entry was posted in ATMEGA8, JY-MCU 3208 and tagged , , , , . Bookmark the permalink.

3 Responses to JY-MCU 3208 – Simple clock & ADC

  1. Cesar Barrios says:

    Excelente, el utilizar diseños que son faqciles de comprar y adsequibles como lo son los de dealxtreme, aveces ahorra el desarrollo del hardware y para simplemente el estudio de los dispositivos es muy captable.

  2. Oscar says:

    Excellent job! It is a good article to begin and program the display. Thank you.

  3. Matheus Gebert says:

    Hello, I would like to ask this códicompleto LED matrix to realize some projects, but I am trying some errors still occur.

Leave a Reply

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