Eigenbau Bodenfeuchte-Sensor-433MHz-LaCrosse-TX2/3 mit ATTiny85 (SpinOff)

Begonnen von juergs, 30 Oktober 2016, 19:57:45

Vorheriges Thema - Nächstes Thema

Tom71

@Papa Die sehen zwar nicht ganz so stabil aus, könnten aber passen. Ggf. muss ich rechts und links noch "Verstrebungen" anlöten. Ich probiers mal.
Homematic | RaspberryMatic

juergs

Hallo papa,

danke für die beiden Tipps.
Den aaduino kannte ich schon, prüfe ich noch mal platztechnisch nach, wenn meine bestellten Batteriehalter-Varianten eintrudeln ...
Der 328er  hätte natürlich mit 32K mehr Flash zu Verfügung, wäre aber aufwendiger in der Herstellung, bzw. beim Löten.
Das scheue ich eigentlich nicht, habe jetzt schon einige 32U4 verarbeitet, aber für den Standard-Anwender zumutbar? 
Die Einzel-Batterie-Feder und -Gegenbleche: gute Idee und wären auch noch eine Überlegung wert, wenn man alles auf eine Platine setzt
und sozusagen in "Einschubtechnik" ins Gehäuse integriert. Allerdings wieder Wartezeit ...

Bei der Anzahl der Batterien bin ich mir nicht ganz so sicher, wie lange z.B. eine AAA-Batterie mit StepUp halten wird.
Vom Kompromiß her (Gehäusegröße zu Batterielebensdauer) würde ich eher 2 Stück bevorzugen.
Mit 2 AA-Batterien würde das Gehäuse schon 30x25mm mit ca. 52 mm Höhe als Grundmaße haben ...
Das probiere ich jetzt einfach mal aus.  :D

@Tom71: könntest Du mal den Link zu den tme-Haltern posten?

Grüße,
Jürgen


Tom71

https://www.tme.eu/de/details/keys629/batterien-behaelter-und-halterungen/keystone/629/
https://www.tme.eu/de/details/keys637/batterien-behaelter-und-halterungen/keystone/637/

Das sind die gleichen, die auch Johan Kanflo verwendet. Bei TME sind die Versandkosten nur recht hoch 5,90.
Allerdings kosten dann bei TME 10 * 629 + 10 * 637 ca. 20€
Homematic | RaspberryMatic

PeMue

Hallo Tom,

ich würde vermutlich ein paar Sachen bei TME mitbestellen, ich stöbere mal und gebe Dir Bescheid ...

Gruß Peter
RPi3Bv1.2 rpiaddon 1.66 6.0 1xHM-CC-RT-DN 1.4 1xHM-TC-IT-WM 1.1 2xHB-UW-Sen-THPL-O 0.15 1x-I 0.14OTAU  1xCUNO2 1.67 2xEM1000WZ 2xUniroll 1xASH2200 3xHMS100T(F) 1xRFXtrx 90 1xWT440H 3xTFA30.3150 5xFA21
RPi1Bv2 LCDCSM 1.63 5.8 2xMAX HKT 1xMAX RT V200KW1 Heizung Wasser

juergs

Anbei mal der Prototyp mit ATtiny841 + 3V3-StepUp-Regler.

Die Varianten mit AAA und AA-Batterien.
AA:    24    x 51.2 x 13.1 (B/L/H)
AAA:  30.4 x 60    x 15

Der 841 ist nicht so üblich, deshalb noch ein paar Anlaufschwierigkeiten:

1. Programming the ATtiny841 with avrdude - VE7XEN's ham radio and electronics blog
https://www.ve7xen.com/blog/2014/03/07/programming-the-attiny841-with-avrdude/
2. ATtiny841 - Microcontrollers and Processors
http://www.microchip.com/wwwproducts/en/ATTINY841
3. Need help using the ATTiny841 with avrdude | AVR Freaks
http://www.avrfreaks.net/comment/1015011#comment-1015011
4. Overview | USBtinyISP | Adafruit Learning System
https://learn.adafruit.com/usbtinyisp

Ich habe mal versucht, die Kapazität der Sensoren zu ermiteln:
Leer:            0.001 nF   = 1 pF
Angefasst:    0.015 nF   = 15 pF

Schaltplan + SW folgt noch  ;)

juergs

Nachdem der ATTINY841 (i) in meiner Programmer-Konfiguration nicht dabei war,
musste ich nach Alternativen suchen .... (ATtiny84-Einstellung war nicht kompatibel ...)

Die Windowsanwendung "Avrdudess" setzt eine Gui über avrdude.
In der avrdude.conf habe ich den Teil für den ATtiny841 hinzugefügt und ist nun über
meinen USBasp-Programmer zu programmieren.

Mein Compile mit den 841-Ergänzungenungen der conf-Datei:
avrdudess mit avrdude auf github
Alternativ kann über "Options" auch der Standort der avrdude.exe konfiguriert werden.

Für USBasp musste ich noch den Treiber auf libusb umswitchen .... http://zadig.akeo.ie/

SOIC-Löten  Bezugsquelle
Nanite841-Bootloader für USB (Micronucleus)
avrdude -c avrisp2 -B 10 -p attiny841 -e -U flash:w:micronucleus-t841_ext_reset.hex:i -U lfuse:w:0xE2:m -U hfuse:w:0xDD:m -U efuse:w:0xF4:m


juergs

Der Zugriff auf den 841 gestaltet sich hartnäckig schwierig:

ZitatUnable to detect MCU

avrdude.exe: set SCK frequency to 1500000 Hz
avrdude.exe: error: program enable: target doesn't answer. 1
avrdude.exe: initialization failed, rc=-1
             Double check connections and try again, or use -F to override
             this check.


avrdude.exe done.  Thank you. 

Dann bin ich mit der Bitclock-Rate in avrdude auf 32KHz  ( war vorher 1,5MHz) gegangen und siehe da:

ZitatDetected 1e9315 = ATtiny841

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

avrdude.exe: set SCK frequency to 32000 Hz
avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude.exe: Device signature = 0x1e9315 (probably t841)
avrdude.exe: reading lfuse memory:

Reading | ################################################## | 100% -0.00s

avrdude.exe: writing output file "C:\Users\Jürgen\AppData\Local\Temp\593e6efe-0897-414a-b866-2a9fae719a5a.TMP"
avrdude.exe: reading hfuse memory:

Reading | ################################################## | 100% -0.00s

avrdude.exe: writing output file "C:\Users\Jürgen\AppData\Local\Temp\28bc6605-68ac-4b47-9b79-949d0f6c1687.TMP"
avrdude.exe: reading efuse memory:

Reading | ################################################## | 100% -0.00s

avrdude.exe: writing output file "C:\Users\Jürgen\AppData\Local\Temp\900b35d6-8679-442a-b31b-2841dd74938d.TMP"

avrdude.exe done.  Thank you.


Jetzt, wo die Fuses bekannt sind lässt sich das Verhalten einfach erklären:
die internen 8MHz werden duch 8 geteilt. Das ergibt 1 MHz Taktfrequenz.
Geht man mit 1.5 MHz ISP SCK drauf .... passt das natürlich nicht.  ;)

Leider gäbe es noch x-andere Gründe warum das nicht gehen könnte....
Im Datenblatt werden 2 mal MISO, MOSI und SCK angegeben....

Für das SOIC-Gehäuse gilt:

  • MOSI - PA6  - Pin 7
  • MISO - PA5  - Pin 8
  • SCK -  PA4  - Pin 9
  • RES -  PB3  - Pin 4

Pin 1 des Chips ist ohne Mikroskop kaum erkennbar (Kerbe und Punkt an Pin1.)
Die SSU-Typen haben das SOIC-Pinout. Es gibt aber auch Schaltpläne mit dem 20p VQFN-Gehäuse (-MU).
Etwas verwirrend für den Anfang ....

Ok, dann kann es weitergehen, wenn die Arduino-IDE noch mitspielt ...

Grüße,
Jürgen

juergs

ATtiny841-Tutorial:
http://elecrab.com/archives/851#more-851

Schaltplan
http://elecrab.com/wp-content/uploads/2014/11/ATtiny841.pdf

Hardware
http://elecrab.com/wp-content/uploads/2014/12/Atmel-2521-AVR-Hardware-Design-Considerations_ApplicationNote_AVR042.pdf

Arduino-Support
https://github.com/SpenceKonde/arduino-tiny-841

Zitat
    On the 1634 and 841, when using the Optiboot bootloader, the Watchdog Timer interrupt vector will always point to the start of the program, and cannot be used for other functionality. Because the 1634 and 841 do not have built-in bootloader support, this is achieved with "virtual boot" feature of Optiboot. This bootloader rewrites the reset and WDT interrupt vectors, pointing the WDT vector at the start of the program (where the reset vector would have pointed), and the reset vector to the bootloader (as there is no BOOTRST fuse). This does not effect the 828 (it has hardware bootloader support), nor does it effect the 1634 or 841 if they are programmed via ISP.
    Some people have problems programming it with USBAsp and TinyISP - but this is not readily reproducible ArduinoAsISP works reliably. In some cases, it has been found that connecting reset to ground while using the ISP programmer fixes things (particularly when using the USBAsp with eXtremeBurner AVR) - if doing this, you must release reset (at least momentarily) after each batch of programming operation.
    At >4v, the speed of the internal oscillator on 1634R and 841 parts increases significantly - enough that neither serial (and hence the bootloader) does not work. It is recommended to run at 3.3v if using internal RC oscillator as a clock source. A future release may include an 8.1mhz internal RC @5v option, with it's own bootloader.
    When using weird clock frequencies (ones with a frequency (in mhz) by which 64 cannot be divided evenly), micros() is 4-5 times slower (~110 clocks); it still reports the time at the point when it was called, not the end, however, and the time it gives is pretty close to reality (w/in 1% or so). This combination of performance and accuracy is the result of hand tuning for these clock speeds. For really weird clock speeds (ie, if you add your own), it will be slower still - hundreds of clock cycles - on the plus side, it still gives reasonably accurate numbers back even on exotic clock speeds, ("stock" micros() executes equally fast at all clock speeds, and just returns bogus values with anything that 64 doesn't divide evenly by)

Breakoutboard
https://oshpark.com/shared_projects/fdF3wDQp
https://www.tindie.com/products/DrAzzy/attiny84184-breakout-wserial-header-bare-board

juergs

Hallo Zusammen,

ich habe eine angepasste Firmware-Version für den ATtiny841 zusammengestellt.


  • Verwendung Duo-Farb-Led zur Statusanzeige
  • Serielle Ausgabe, als Debugging-Möglichkeit (841 verfügt über zwei Hardware Serielle Schnittstellen)
  • DS18B20 als Temperaturausgabe als [TEMP]-Reading mit CUL_TX-Device
  • Bodenfeuchte als [HUM]-Reading
  • VCC-Reading über zweite Sensor-ID (HUM)
  • Einige Code-Korrekturen und Stomverbrauch im Deep_Sleep-Modus wieder unter 10 MikroAmpere (WDTCSR-Register).
  • 8K flash, wie immer an der Grenze (besser ATTINY1634? Vergleichsliste:(
  • Kein Bootloader!

Einige Hürden waren doch noch zu nehmen:
Datenblatt-Pinout ist etwas mißverständlich.
Einige Register sind nicht ATTINY85 kompatibel.
AVRdude muss gepatcht werden. 32KHz als ISP-Clock erforderlich (Ursache ... zu klären, evtl. wg. Patch?).
Programmier GUI: avrdudess für Windows und Linux mit Mono.
Vermeiden der ISP-Ports, bzw. jeweils mit >330 Ohm von der Restfunktionalität entkoppeln.
8K Flash schnell verbraucht, wenn orginal Arduino Serial-Unterstützung zugelinkt wird. (Evtl. doch noch kleinere Variante suchen ...)
Überflüssiger Code auskommentiert, um ein paar Bytes zurückzugewinnen.
Fuse-Settings: L:0xE2 H:0xDF E:0xFF (8MHz internal clock source) => 3V3-Betrieb.
USB-Support möglich: nanite-841 aber nicht erforderlich.

Beta-841-Bodenfeuchte-Code, Hex-Datei und weitere Infos unter github:
https://github.com/juergs/Bodenfeuchte_ATtiny841

Schaltplan + Gehäuse sind noch in der Mache ....  :)

juergs

Zitat2017-03-27 21:50:22 CUL_TX CUL_TX_120 T: 21.0 H: 16.6
2017-03-27 21:50:22 CUL_TX CUL_TX_120 temperature: 21.0
2017-03-27 21:50:23 CUL_TX CUL_TX_120 T: 21.0 H: 16.6
2017-03-27 21:50:23 CUL_TX CUL_TX_120 humidity: 00.2
2017-03-27 21:50:24 CUL_TX CUL_TX_121 H: 03.2
2017-03-27 21:50:24 CUL_TX CUL_TX_121 humidity: 03.2

VCC wird auf ID 121 gesendet. Zum Programmieren waren 5V angelegt ...
Codeänderung controllerVcc auf float gecastet = 3.2 Volt -> OK!

juergs

Schaltplan des Prototyps.

Tom71

Woher hast du den ATtiny841 bezogen? EBay?


Gesendet von iPhone mit Tapatalk
Homematic | RaspberryMatic

juergs

 :) Günstiger als in der Bucht ... hier
Für den 1634 ließ sich der Shop aber leider nicht überreden.  :(

juergs

Mit dem 3D-gedruckten PET-G Gehäuse bin ich etwas weitergekommen,
aber noch immer noch nicht ganz zufrieden.

Für die selbstgestrickte Prototyp-Platine wird das Gehäuse einfach zu klobig (31mm hoch),
da Batterie und Platine aufeinander zu liegen kommen.

Also brauche ich noch weitere Iterationen ...  :(

Ideen wilkommen ...