sexta-feira, 24 de junho de 2011

Componentes do relógio

            Retomamos hoje nossa discussão pra falar sobre as ligações entre o microcontrolador e seus periféricos.
Tão importante quanto os componentes certos, ou suas ligações, são também os valores utilizados, seguem ai dois exemplos disso:
Um capacitor usado para debounce não irá funcionar para um valor muito baixo, e irá afetar a velocidade do botão se for muito alto.
Já um resistor mal escolhido pode dar uma queda de tensão muito baixa e fritar o próximo componente, uma queda muito alta poderia fazer com que o componente ligado não tivesse tensão suficiente para “ligar”.
O HT1380 é responsável pelo clock externo, e deve ser utilizado junto com um cristal, seu clock Maximo é de 500kHz, então utilizaremos um cristal de 33kHz.
O LM 7805 é um regulador de tensão, será utilizado pra baixar a tensão de 9V da pilha  para os 5V que serão utilizados no circuito. Ao utilizá-lo deve-se tomar especial cuidado para não inverter os pinos.
O LM 35 é um medidor de temperatura, que pode medir em media temperaturas de -65oC ate 150oC, creio que ninguém vá levar nosso relógio para o polo sul nem pra dentro do forno, então esse componente será o suficiente para nossas necessidades. Esse componente também exige correto posicionamento dos pinos.
Segue uma tabela com os valores dos componentes seus códigos adotados no esquemático e suas funções.


ComponenteValorFunção
U1MSP430F2013Microcontrolador
HT1380Clock externo
LM 78055VRegulador de tensão
LM 355VSensor de temperatura
R147KΩResistor
R (2-10)10KΩResistor
C (1-5)100nFCapacitor
C (6,7)5pFCapacitor
Pot110KΩPotenciômetro
Osc32KHzCristal 
Bat9VBateria (Vcc)
J1-Conector
S (1-4)-Botão 

Você pode encontrar os datasheet dos componentes no nosso site: https://sites.google.com/site/embarcadosunifei/home/arquivos-do-blog
A seguir uma imagem para esclarecer o correto posicionamento dos LMs:




A imagem a seguinte é o esquemático do nosso futuro relógio:
O sinal “*” nos capacitores e nos resistores significam que eles não são absolutamente necessários, os resistore são pull-ups, e os capacitores são para debounce.


Bom é isso, até semana que vem, quando vamos explicar um pouco sobre o consumo de potência da placa.

sexta-feira, 17 de junho de 2011

Electronic design



Today we finally arrived to the domain of electronics, let's design the bindings for the clock with the microcontroller MSP430F2013. To start let's review the components that we use: MSP (14-pin), lcd (10 pins), HT1380 (8-pin), LM35 (3 pins) and buttons (2-pin). We start then the connection between peripherals and micro, as we see in the table in the previous post pin 2 is an analog input then this will be connected to the LM35, pins 3, 4 and 5 are i/o therefore are to be connected to the 3 buttons, pins 6, 7, 8, 9, 12 and 13 are also I/logo will be attached to 6-pin lcd data, but the same 7, 8 and 9 are also serial, so connect to HT1380, because the pins 10 and 11 are PIN connected to the recorder, but as the 10 is to reset this will have a reset button, finally the pins 1 and 14 are respectively connected to the source and Earth.
Ready the micro is already connected, now let's think in connection of other components, in HT1380 your pin 1 is not connected, the pins 2 and 3 go to Crystal, pin 4 is grounded, the pins 5, 6 and 7 go to the MSP and the 8 is the pin of the font.
The lcd has 5 grounded pins 1 and 2, and 3 direct at source connected to the source by a potentiometer, already the pins 4, 6, 7, 8, 9 and 10, go to the micro.
LM35, by default simply plug a PIN in a source on Earth and the other on micro.
The first should have buttons, pull up resistors, activate the micro in low State (0). In addition, to be more efficient and require less work in software, which sometimes ends up being more economically feasible, must have debounce by hardware.
The bouncing occurs on switches due to mechanical strength in component, thus when squeezed the button fluctuates several times before stabilize:




To minimize is done the debounce, softening the effect, and can be performed in software, hardware, or both:



In the case of the switch hardware debounce is connected in series to a resistor and capacitor in parallel to a.
Now the components are all connected, but still lack something ... Yes the power supply, of course! Good, as our clock should be something portable and inexpensive an external AC/DC source is not a good option, so the power supply should be made with a battery.
As the battery should be long-lasting it will have a heavy load and not to fry up the MSP will have to put a voltage regulator (LM7805), whose link is similar to (LM35). In addition, for the greater protection of the microcontroller you must put a capacitor filter between the source and ground of this, plus a resistor between source the reset.
Now the project is already taking shape, next week we'll look at the infamous Schematic of the circuit.

sexta-feira, 10 de junho de 2011

Projeto eletrônico do microcontrolador

 Hoje finalmente chegamos ao domínio da eletrônica, vamos projetar as ligações para o relógio com o microcontrolador MSP430F2013. Para começarmos vamos rever os componentes que devemos usar: MSP (14 pinos), lcd (10 pinos), HT1380 (8 pinos), LM35 (3 pinos) e botões (2 pinos). Iniciemos então a ligação entre periféricos e micro, como podemos ver na tabela do post anterior o pino 2 é uma entrada analógica então este será ligado ao LM35, os pinos 3, 4 e 5 são I/O portanto serão ligados aos 3 botões, os pinos 6, 7, 8, 9, 12 e 13 são também I/O logo serão ligados ao 6 pinos de dados do lcd, mas os mesmos 7, 8 e 9 são seriais também, assim ligam-se ao HT1380, já os pinos 10 e 11 são pinos ligados ao gravador, porém como o 10 é para reset este terá um botão de reset, por fim os pinos 1 e 14 são respectivamente ligados à fonte e ao terra.
Pronto o micro já está conectado, agora vamos pensar na ligação dos outros componentes, no HT1380 seu pino 1 é não conectado, os pinos 2 e 3 vão ao cristal, o pino 4 é aterrado, os pinos 5, 6 e 7 vão para o MSP e o 8 é o pino da fonte.
O lcd tem os pinos 1 e 5 aterrados, o 2 direto na fonte e o 3 ligado à fonte por um potenciômetro, já os pinos 4, 6, 7, 8, 9 e 10, vão para o micro.
O LM35, por padrão basta ligar um pino na fonte, um no terra e o outro no micro.
Os botões, primeiramente devem ter resistores de pull up, ativam o micro em estado baixo (0). Além disso, para serem mais eficientes e exigirem menos de trabalho em software, que às vezes acaba sendo mais economicamente viável, deve ter debounce em hardware.
O bouncing ocorre em switches devido à resistência mecânica no componente, assim quando apertado o botão oscila várias vezes antes de firmar-se:



Para minimizar é feito o debounce, suavizando esse efeito, podendo ser realizado em software, hardware ou em ambos:



No caso do debounce em hardware o switch é ligado em série a um resistor e em paralelo a um capacitor.
Agora sim os componentes estão todos conectados, mas ainda falta algo ... sim a fonte de alimentação, claro! Bom, como nosso relógio deverá ser algo portátil e barato uma fonte AC/DC externa não é uma boa opção, por isso a alimentação deverá ser feita com uma bateria.
Como a bateria deverá ser de longa duração ela terá uma carga grande e para não fritar o MSP teremos que colocar um regulador de tensão (LM7805), cuja ligação é semelhante ao (LM35). Além disso, para a maior proteção do microcontrolador deve-se colocar um capacitor filtro entre a fonte e o terra deste, além de um resistor entre a fonte o reset  do mesmo.
Agora o projeto já está tomando forma, na próxima semana veremos o famigerado esquemático do circuito, até lá.

sexta-feira, 3 de junho de 2011

Design of microcontroller ports.

Returning to our discussion of the previous post, we will take towards the definition of the function of each pin of the MSP430F2013 microcontroller. Remembering that we have as peripherals: buttons, lcd, external timer and temperature sensor. So for the buttons, and LCD timer will have to use I / O ports, and an analog port to sensor . Analyzing the port configuration we get:


So we have 10 I / O ports being 8 analog and serial 3, the large number of analog ports MSP makes a micro very flexible, and cheap, so can be used in numerous projects with different peripherals to be controlled, serial ports multiply even more there capacity. For this reason is a microcontroller widely used in the electronics industry.

                                  - Taken from: http://www.lcd-module.de/eng/pdf/doma/dip162-de.pdf

The LCD model we use is a standard 2x16 with 16 ports. Then the pins 1 and 5 are grounded, the 2 goes in Vcc, the 3 is the contrast adjustment, and a pot goes connecting to, the pins 4 and 6 to 10 are given these go into the microcontroller. As you can see we are working with half the data pins, only 4 bits, this adjustment is needed because the microcontroller need be able to support all peripherals.
The timer that will work with an HT1380 is a 33KHz crystal, this MSP will use 3 ports, these are the serial ports.


An analogical port will be dedicate to the input of the temperature sensor LM35. So of the 10 available ports are connected to the MSP 6 lcd, timer 3 are parallel to the LCD 3, and 1 is connected to the sensor, leaving us 3 free ports of 10. These ports are connected to 3 buttons that will set the clock.
Finally all the doors of the computer are busy with their own devices, we must now consider how these are connected, but this is a subject for another post.
So 6 of the 10 available ports on MSP are connected to the LCD, the 3 of the timer are parallel to the 3 of  LCD, and 1 is connected to the sensor, leaving us 3 free ports of 10. These ports are connected to 3 buttons that will set the clock.
 
Finally all the doors of the computer are busy with their own devices, we must now consider how these are connected, but this is a subject for another post.