Site Tools


en:tech:tonohmmeter

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:tech:tonohmmeter [2020/10/14 12:13] – created bullaren:tech:tonohmmeter [2022/09/26 10:00] (current) – external edit 127.0.0.1
Line 39: Line 39:
 Since I liked the handheld housing from HAMMOND, it was difficult to find a LiPo that was the right size. Unfortunately I only found one for the front, so the board got a bit tight and is populated on both sides. At one end are the two jack sockets for the measuring strips and at the bottom the charging socket with charge indicator. The unused routing area is designed as a ground area. The AVD-ISP connection can be seen on the left, which enables us to do on-board programming. Since I liked the handheld housing from HAMMOND, it was difficult to find a LiPo that was the right size. Unfortunately I only found one for the front, so the board got a bit tight and is populated on both sides. At one end are the two jack sockets for the measuring strips and at the bottom the charging socket with charge indicator. The unused routing area is designed as a ground area. The AVD-ISP connection can be seen on the left, which enables us to do on-board programming.
  
 +==== Software ====
 +The program needs less than 2K which is why an ATTINY24 would be sufficient. Because of that - you never know - I took the ATTINY44 anyway. The program development as usual in C on AVR Studio6 and debugged with AVR-DRAGON.
 +
 +The SPI interface to the programmable resistor (POT) has done a little work. On the one hand, the POT requires a bidirectional data pin (SDI and SDO together) and, on the other hand, I could not abuse the USI because it was on unfavorable ports.
 +The S/W emulation then looks like this:
 +
 +<code C>
 +// SPI write emulation (with SDI/SDO multiplexing)
 +void SPI_write(uint8_t addr, uint16_t data)  {
 + TIMSK0 &= ~(1<<OCIE0B); // Stop 1KHz (PA6)
 + TCCR1B = 0; // stop timer (no tone signal)
 +
 + PORTA |= (1<<PA6) | (1<<PA4); // SCK=SDIO HIGH
 + DDRA |= (1<<PA6) | (1<<PA4); // SCK+SDIO to output
 +
 + PORTA &= ~(1<<PA2); // CS low
 +
 + // Address AD0..3 (bit15...12)
 + for (i=3;i>=0;i--) {
 + PORTA ^= (1<<PA6); // SCK = LOW
 + if ((addr & (1<<i)) == 0)
 + PORTA &= ~(1<<PA4);
 + else
 + PORTA |= (1<<PA4);
 + PORTA ^= (1<<PA6); // SCK = HIGH
 + }
 +
 + // Command C1,C0 (bit11,10)
 + PORTA ^= (1<<PA6); // SCK = LOW
 + PORTA &= ~(1<<PA4); // Data = LOW
 + _delay_us(5);
 + PORTA ^= (1<<PA6); // SCK = HIGH
 + _delay_us(5);
 + PORTA ^= (1<<PA6); // SCK = LOW
 + _delay_us(5);
 + PORTA ^= (1<<PA6); // SCK = HIGH
 +
 + // Data D9..0 (bit9..0)
 + DDRA |= (1<<PA4); // set SDIO to output
 + for (i=9;i>=0;i--) {
 + PORTA ^= (1<<PA6); // SCK = LOW
 + if ((data & (1<<i)) != 0) {
 + PORTA |= (1<<PA4);
 + } else {
 + PORTA &= ~(1<<PA4);
 + }
 + PORTA ^= (1<<PA6); // SCK = HIGH
 + }
 +
 + PORTA |= (1<<PA2); // CS to HIGH
 + DDRA |= (1<<PA4); // SDIO to output
 +
 + TIMSK0 |= (1<<OCIE0B); // Restart 1KHz (PA6)
 + TCCR1B |= (1<<WGM12) | (1<<CS11); // Restart TIMER with CLK/8
 +}
 +
 +</code>
 +
 +The complete program can be found in the download area below.
 +
 +==== Operation ====
 +The device is switched on by pressing the button. For the first two seconds, the charge status of the battery is shown by the three yellow LEDs (3 LEDs at> 75%, 2 LEDs> 50% and one above 25%). If the battery capacity is below 25%, it must first be recharged. The circuit remains in sleep mode. After a successful start, an acknowledgment tone sounds for 2 seconds and the device is ready for use. The measured resistance value is converted into a suitable frequency from 500Hz to 2 KHz - provided it is in the measuring range - output. The measuring range is changed by pressing the button again. If you keep the button pressed for more than 2 seconds, the device switches to sleep mode and switches off.
 +
 +==== Manufacturing ====
 +Although mainly SMD components are used due to the lack of space, the board can be easily soldered. I soldered the back with the SMD components using the pizza pan method of the c't hacks. The front with the controls then hold by hand. In order to fit into the housing, the 2x3 post connector must be shortened by hand.
 +A bit of drilling and filing is required for the case. A drilling template is available in the download area to help you.
 +
 +==== Outlook ====
 +True to the motto: a finished software is outdated, the current S / W version has the basic functions described but can always be improved. Incidentally, the power requirement in operation without sound output is approximately 13 mA, with sound output 23 mA. Stand-by hits with 215uA. So you can get by for half a year without reloading. In continuous operation you probably get 2-3 days. The practical test at home will hopefully confirm this.
 +
 +==== Downloads ====
 +  * {{: tech: Tonohmmeter_v11.c.zip | Firmware Source Code}} in C
 +  * {{: tech: TonOhmMeter_HEX.zip | HEX files for fast programming}}
 +  * {{: tech: Tonohmmeter.pdf | drilling template front side}}
 +  * {{: tech: Tonohmmeter_bom.pdf | Equipment list (BOM)}}
 +  * {{: tech: TonOhmMeter_BOTTOM.pdf | assembly plan back side}}
 +  * {{: tech: TonOhmMeter_TOP.pdf | Assembly plan front side}}
 +
 +==== Links ====
 +  * [[http://www.heise.de/hardware-hacks/artikel/SMD-Loeten-in-der-Pizzapfanne-1276166.html]] SMD soldering with simple means
 +  * [[http://www.reichelt.de]] Almost all components are from there
 +  * [[http://shop.lipopower.de/1050-mAh-Einzelzelle-1C-30mm]] The LiPo of my choice
 +  * [[http://shop.lipopower.de/PCB-2-A-1-Zelle-Lipo-LiFePO-137]] The LiPO protection PCB
 +  * [[http://www.schnepp-neudenau.de/img/katalog.pdf]] The solderable measuring tip
 +  * [[http://www.fischer-leiterplatten.de]] The PCB maker
 +
 +The circuit board can be obtained from me at cost price of EUR 7.00 (as long as the sample stock lasts).
 +
 +==== Donate ====
 +
 +If you like my articles feel to donate a cappuccino or so...
 +
 +<html>
 +
 +<form action="https://www.paypal.com/donate" method="post" target="_top">
 +<input type="hidden" name="hosted_button_id" value="49N24HL36GF9U" />
 +<input type="image" src="https://www.paypalobjects.com/en_US/DK/i/btn/btn_donateCC_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
 +<img alt="" border="0" src="https://www.paypal.com/en_DE/i/scr/pixel.gif" width="1" height="1" />
 +</form>
 +
 +</html>
  
en/tech/tonohmmeter.1602677628.txt.gz · Last modified: 2020/10/14 13:13 (external edit)