diff --git a/Attiny_Solar_Energy_Harvest/docs/1.aux b/Attiny_Solar_Energy_Harvest/docs/1.aux new file mode 100644 index 0000000..8e61edf --- /dev/null +++ b/Attiny_Solar_Energy_Harvest/docs/1.aux @@ -0,0 +1,4 @@ +\relax +\@writefile{toc}{\contentsline {section}{\numberline {1}Attiny Solar Energy Harvest Tests}{1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Micro Considerations}{1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Energy Storage}{1}} diff --git a/Attiny_Solar_Energy_Harvest/docs/1.log b/Attiny_Solar_Energy_Harvest/docs/1.log new file mode 100644 index 0000000..a4b607f --- /dev/null +++ b/Attiny_Solar_Energy_Harvest/docs/1.log @@ -0,0 +1,275 @@ +This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex 2019.8.17) 23 MAR 2020 00:41 +entering extended mode + restricted \write18 enabled. + %&-line parsing enabled. +**/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/ +Attiny_Solar_Energy_Harvest/docs/1.tex + +(/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/A +ttiny_Solar_Energy_Harvest/docs/1.tex +LaTeX2e <2017/01/01> patch level 3 +Babel <3.9r> and hyphenation patterns for 3 language(s) loaded. +(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls +Document Class: article 2014/09/29 v1.4h Standard LaTeX document class +(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo +File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) +) +\c@part=\count79 +\c@section=\count80 +\c@subsection=\count81 +\c@subsubsection=\count82 +\c@paragraph=\count83 +\c@subparagraph=\count84 +\c@figure=\count85 +\c@table=\count86 +\abovecaptionskip=\skip41 +\belowcaptionskip=\skip42 +\bibindent=\dimen102 +) +(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty +Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) + +(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty +Package: keyval 2014/10/28 v1.15 key=value parser (DPC) +\KV@toks@=\toks14 +) +(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty +Package: graphics 2016/10/09 v1.0u Standard LaTeX Graphics (DPC,SPQR) + +(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty +Package: trig 2016/01/03 v1.10 sin cos tan (DPC) +) +(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg +File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration +) +Package graphics Info: Driver file: pdftex.def on input line 99. + +(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/pdftex.def +File: pdftex.def 2017/01/12 v0.06k Graphics/color for pdfTeX + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty +Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO) +) +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty +Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO) +) +\Gread@gobject=\count87 +)) +\Gin@req@height=\dimen103 +\Gin@req@width=\dimen104 +) +(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty +Package: caption 2016/02/21 v3.3-144 Customizing captions (AR) + +(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty +Package: caption3 2016/05/22 v1.7-166 caption3 kernel (AR) +Package caption3 Info: TeX engine: e-TeX on input line 67. +\captionmargin=\dimen105 +\captionmargin@=\dimen106 +\captionwidth=\dimen107 +\caption@tempdima=\dimen108 +\caption@indent=\dimen109 +\caption@parindent=\dimen110 +\caption@hangindent=\dimen111 +) +\c@ContinuedFloat=\count88 +) +(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty +Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK) + +(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg +File: color.cfg 2016/01/02 v1.6 sample color configuration +) +Package xcolor Info: Driver file: pdftex.def on input line 225. +Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1348. +Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1352. +Package xcolor Info: Model `RGB' extended on input line 1364. +Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366. +Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367. +Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368. +Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369. +Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370. +Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371. +) +(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty +Package: geometry 2010/09/12 v5.6 Page Geometry + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty +Package: ifpdf 2016/05/14 v3.1 Provides the ifpdf switch +) +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty +Package: ifvtex 2016/05/16 v1.6 Detect VTeX and its facilities (HO) +Package ifvtex Info: VTeX not detected. +) +(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty +Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional +) +\Gm@cnth=\count89 +\Gm@cntv=\count90 +\c@Gm@tempcnt=\count91 +\Gm@bindingoffset=\dimen112 +\Gm@wd@mp=\dimen113 +\Gm@odd@mp=\dimen114 +\Gm@even@mp=\dimen115 +\Gm@layoutwidth=\dimen116 +\Gm@layoutheight=\dimen117 +\Gm@layouthoffset=\dimen118 +\Gm@layoutvoffset=\dimen119 +\Gm@dimlist=\toks15 +) (./1.aux) +\openout1 = `1.aux'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 12. +LaTeX Font Info: ... okay on input line 12. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 12. +LaTeX Font Info: ... okay on input line 12. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 12. +LaTeX Font Info: ... okay on input line 12. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 12. +LaTeX Font Info: ... okay on input line 12. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 12. +LaTeX Font Info: ... okay on input line 12. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 12. +LaTeX Font Info: ... okay on input line 12. + +(/usr/share/texlive/texmf-dist/tex/context/base/mkii/supp-pdf.mkii +[Loading MPS to PDF converter (version 2006.09.02).] +\scratchcounter=\count92 +\scratchdimen=\dimen120 +\scratchbox=\box26 +\nofMPsegments=\count93 +\nofMParguments=\count94 +\everyMPshowfont=\toks16 +\MPscratchCnt=\count95 +\MPscratchDim=\dimen121 +\MPnumerator=\count96 +\makeMPintoPDFobject=\count97 +\everyMPtoPDFconversion=\toks17 +) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty +Package: pdftexcmds 2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO +) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty +Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO) +Package ifluatex Info: LuaTeX not detected. +) +Package pdftexcmds Info: LuaTeX not detected. +Package pdftexcmds Info: \pdf@primitive is available. +Package pdftexcmds Info: \pdf@ifprimitive is available. +Package pdftexcmds Info: \pdfdraftmode found. +) +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty +Package: epstopdf-base 2016/05/15 v2.6 Base part for package epstopdf + +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty +Package: grfext 2016/05/16 v1.2 Manage graphics extensions (HO) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty +Package: kvdefinekeys 2016/05/16 v1.4 Define keys (HO) +)) +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty +Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty +Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty +Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO) +Package etexcmds Info: Could not find \expanded. +(etexcmds) That can mean that you are not using pdfTeX 1.50 or +(etexcmds) that some package has redefined \expanded. +(etexcmds) In the latter case, load this package earlier. +))) +Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4 +38. +Package grfext Info: Graphics extension search list: +(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE +G,.JBIG2,.JB2,.eps] +(grfext) \AppendGraphicsExtensions on input line 456. + +(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg +File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv +e +)) +Package caption Info: Begin \AtBeginDocument code. +Package caption Info: End \AtBeginDocument code. + +*geometry* detected driver: dvips +*geometry* verbose mode - [ preamble ] result: +* driver: dvips +* paper: custom +* layout: +* layoutoffset:(h,v)=(0.0pt,0.0pt) +* vratio: 1:1 +* modes: +* h-part:(L,W,R)=(54.2025pt, 325.215pt, 54.2025pt) +* v-part:(T,H,B)=(79.49689pt, 491.43622pt, 79.49689pt) +* \paperwidth=433.62pt +* \paperheight=650.43pt +* \textwidth=325.215pt +* \textheight=491.43622pt +* \oddsidemargin=-18.06749pt +* \evensidemargin=-18.06749pt +* \topmargin=-29.7731pt +* \headheight=12.0pt +* \headsep=25.0pt +* \topskip=11.0pt +* \footskip=30.0pt +* \marginparwidth=59.0pt +* \marginparsep=10.0pt +* \columnsep=10.0pt +* \skip\footins=10.0pt plus 4.0pt minus 2.0pt +* \hoffset=0.0pt +* \voffset=0.0pt +* \mag=1000 +* \@twocolumnfalse +* \@twosidefalse +* \@mparswitchfalse +* \@reversemarginfalse +* (1in=72.27pt=25.4mm, 1cm=28.453pt) + +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <12> on input line 14. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <8> on input line 14. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <6> on input line 14. +LaTeX Font Info: Try loading font information for OMS+cmr on input line 22. +(/usr/share/texlive/texmf-dist/tex/latex/base/omscmr.fd +File: omscmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions +) +LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <10.95> not available +(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 22. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <10.95> on input line 33. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <9> on input line 33. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <5> on input line 33. + [1 +Non-PDF special ignored! + +{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] +[2] (./1.aux) ) +Here is how much of TeX's memory you used: + 3529 strings out of 494945 + 53620 string characters out of 6181032 + 118045 words of memory out of 5000000 + 6806 multiletter control sequences out of 15000+600000 + 9722 words of font info for 34 fonts, out of 8000000 for 9000 + 14 hyphenation exceptions out of 8191 + 39i,8n,38p,487b,189s stack positions out of 5000i,500n,10000p,200000b,80000s + +Output written on 1.pdf (2 pages, 78034 bytes). +PDF statistics: + 39 PDF objects out of 1000 (max. 8388607) + 27 compressed objects within 1 object stream + 0 named destinations out of 1000 (max. 500000) + 1 words of extra memory for PDF output out of 10000 (max. 10000000) + diff --git a/Attiny_Solar_Energy_Harvest/docs/1.pdf b/Attiny_Solar_Energy_Harvest/docs/1.pdf new file mode 100644 index 0000000..535aea4 Binary files /dev/null and b/Attiny_Solar_Energy_Harvest/docs/1.pdf differ diff --git a/Attiny_Solar_Energy_Harvest/docs/1.tex b/Attiny_Solar_Energy_Harvest/docs/1.tex new file mode 100644 index 0000000..0216ced --- /dev/null +++ b/Attiny_Solar_Energy_Harvest/docs/1.tex @@ -0,0 +1,38 @@ + +\documentclass[11pt]{article} +%Gummi|065|=) +\usepackage{graphicx} +\usepackage{caption} +\usepackage{xcolor} +\usepackage[vcentering,dvips]{geometry} +\geometry{papersize={6in,9in},total={4.5in,6.8in}} +\title{\textbf{Door Alarm}} +\author{Steak Electronics} +\date{} +\begin{document} + +\maketitle + +%\tableofcontents +\textcolor{green!60!blue!70}{ + \section{Attiny Solar Energy Harvest Tests}} + +I have the following: +\begin{itemize} +\item Solar panels +\item Attiny 10 +\end{itemize} +To this list, I will add a supercap, and an energy harvesting IC. The goal being to load the super cap during the day, and to run 24/7. I will need an exceptionally low power micro. The super cap will need to be about 3.3V or 5V. + +\subsection{Micro Considerations} +The Arduino Atmega328P is not an option. I'm looking to have a current draw of only 1mA max, (ideally 500uA) when active. Moteino is also not an option for this. Those are made for batteries. I want to be battery free. A super cap, however can be used to store energy. I'll get to that shortly. + +For micros, I have some Attiny10 on hand, and these have a reasonably low power pull in active mode. Let's build those up first. What will the micro do? No idea. I haven't a clue. + +\subsection{Energy Storage} +I don't want a battery. Let's go with a super cap. The solar panels will only be active some of the time, so I will want to harvest energy with some kind of IC into the cap when the sun is out.\footnote{Reference: www.analog.com/media/en/technical-documentation/technical-articles/solarenergyharvesting.pdf is a start. I'll need to do more research.} + + + +\end{document} + diff --git a/Attiny_Solar_Energy_Harvest/docs/1.tex~ b/Attiny_Solar_Energy_Harvest/docs/1.tex~ new file mode 100644 index 0000000..e01729a --- /dev/null +++ b/Attiny_Solar_Energy_Harvest/docs/1.tex~ @@ -0,0 +1,126 @@ + +\documentclass[11pt]{article} +%Gummi|065|=) +\usepackage{graphicx} +\usepackage{caption} +\usepackage{xcolor} +\usepackage[vcentering,dvips]{geometry} +\geometry{papersize={6in,9in},total={4.5in,6.8in}} +\title{\textbf{Door Alarm}} +\author{Steak Electronics} +\date{} +\begin{document} + +\maketitle + +%\tableofcontents +\textcolor{green!60!blue!70}{ +\section{Door Chime}} +Client wants a door alarm. Let's do a few transistors, an audio amplifier board, a magnet and magnetic reed switch, along with a light switch. + +Functionality req'd: +\\ +\\ +Makes noise when door opened. +\\ +\\ +Able to be shut off with light switch. + +\textcolor{green!60!blue!70}{ +\subsection{BOM}} +Any audio amplifier loud enough will work. I'm going to use this one: +\\ +\\ +IS31AP4088A-QFLS2-EB +\\ +\\ +I think I have speakers and transistors. I'll need a magnetic reed switch and magnet. They should be black, as the door is black. +\\ +\\ +MS-324-3-3-0500 +\\ +\\ +let's also try 59140-1-S-03-A,\footnote{A and F ending letters on this, A is tinned, F untinned leads} as first co. doesn't make the matched magnets... +\\ +\\ +and the magnet, + +57140-000 + +A speaker, although I have plenty in my junk bin. +AS07708PS-2-WR-R +\\ +\\ +That's a start. + +\textcolor{green!60!blue!70}{ +\subsection{Work Log: LM324, LM555, TIP120,125}} +I spent a bit on this during the evening. I tried first with a LM324, in falstad (sim software) to see if I could make a function gen, out of 3 op amps. I was unable to get the sim to work, although reportedly the circuit works online (ref: https://www.eevblog.com/forum/beginners/simple-analog-function-generator-design/msg1174548/\#msg1174548) + +I decided instead, to simulate a triple 5 with a LM324, to finally a transistor output, and this worked in sim. I breadboarded the circuit however, the output was not switching correctly. It turned out later, that I had not read my TIP125 close enough - it is a PNP. Oops. + +Before realizing this error, I breadboarded two op amps, (ref: https://electronics.stackexchange.com/questions/311648/obtaining-a-triangle-wave-from-a-square-wave-using-a-lm324n-op-amp) and these were able to make the square / triangle wave without issue. Not practical in this situation however, as the freq. is low. I tried adjusting via the R between output 1 and inverting input for op amp 2, but this did not work as expected. I had long leads with a variable resistance box. Most likely, the issue. + +Next, I will breadboard the triple 5 with the LM324 (which may be optional) and use that. I will throw in an Arduino to switch the triple 5 on/off via the RST pin. This will allow for some adjustment of tone.\footnote{I could just use the tone() function on the Uno, and have a transistor handle the output, but the goal of this project was to lean more towards the analog.} Future improvements would be to get some way of removing the Arduino from the project. I would need a solution that will adjust how often the RST pin is switched, for some short period of time while the door magnet switch is active. + +I might end up just using tone, if the 555 doesn't sound good. + +\textcolor{green!60!blue!70}{ +\subsection{Door Magnet Reed Sensor}} +I tried buying one from mouser,digikey but they are all small. Seems the standard is 28mm by 10mm or so. I didn't realize it until I purchased it, but it looks quite a bit smaller than I am used to. Not acceptable. + +I spent some time looking at all the options. I was unable to find the bigger size. Even the imports from Sparkfun and Adafruit were small. There was a nice screw terminal omrom option but it was \$30. I opted for ebay where there were some used, brand name, sensors in the US. I found some for about \$5 each, including magnet AND the sensor (on mouser/digikey, you often have to get them separately). + +\textcolor{green!60!blue!70}{ +\subsubsection{Buzzer or Bell}} +I thought about a buzzer. Like, a ringer from a telephone. I didn't find them on mouser/digikey, but I did see a lot of piezo buzzers. Need to look again. Even better would be a bell, but that requires an actuator or a motor. I don't want to deal with moving parts, it will be more likely to break. Let's put that idea aside for another day. + +Still, I like the idea of a bell, and an actuator to ring it... + +I tried one on ebay. If that doesn't work there is this one: +https://www.allelectronics.com/item/sol-154/12vdc-push-type-solenoid/1.html +per this discussion: https://forum.sparkfun.com/viewtopic.php?t=10308 + +As for the bell, I will hold off until I know how the solenoid works. +\footnote{I decided that the sound of the bell is worth the risk of using moving parts.} + +\textcolor{green!60!blue!70}{ +\subsubsection{Signal Mosfets for Actuator}} +I have a solenoid, from ebay (actuator) and I've got a bell\footnote{I ring it in the morning... I ring it in the evening...}. + +I tried some 2n7000 signal mosfets (to-92), and I am unable to get it to work. I think it's due to current limits (200mA). These, the 2n7000 have protection diodes built in, according to data sheet image. + +In any case, I set up the small npn transistor with 1k to base (grounded) and a 12V battery, with the motor on the collector/drain side. What happens is that it doesn't switch (as it shouldn't) when base is grounded, but float the base, and it switches on, sometimes. Eventually, it will just turn on no matter what, whether base is grounded or not. As I mentioned, these to-92's can't handle the actuator. + +I could always use a relay, but that wasn't the point. I'm trying to get the transistors to work. I also tried a TIP120, NPN, darlington mosfet, but this didn't work on the perf board, and I moved to the 2n7000. + +EDIT: I was able to get expected results from the 2N7000, by not forgetting the diode across the motor. Put gate low, it is off. Put gate high, it is on. However, it latches. I have to put the gate low again in order to get it to turn off... + +A solution to rememdy this is to hold the base/gate at ground with a 2.2K R, then short the base HI (12V here) to turn it on (quickly, and shortly) before letting it go back to ground. Seems to work with no ringing at GND after coil is off. Or, just use an arduino and wire to IO. + +Also, I definitely did blow some of the Mosfets, without the diode on the motor. They have their own protection, but that isn't enough by itself. + +In other news, the bell is looking like a better solution than the speaker I considered before. More moving parts, but worth it. + +\textcolor{green!60!blue!70}{ +\subsection{Basic Circuit Ready}} +I have built the circuit with a to220 mosfet, with 12V on the source, and powered by a 5V IO from an Arduino uno going through a 1K resistor before hitting the gate. It hits the gate at 1.3V about. Around 1Volt, it lightly sets off the actuator, 1.06V the actuator is fully activated. + +Wanted to use a 555, but no time for that today. Next step is to build the enclosure around everything, so the bell is hit correctly. Wood may be too much of a fire hazard. Need to think about this. Looking up building materials that are resilient to fire comes up with stone, basically. Glass, concrete, stucco, gypsum, and brick. I like the glass option. I think I will go with that. Not going to be easy, but fireproof. I have a lot of glass hanging around after demoing some windows. Another option might be to use some drywall, and build something with joint compound. A type of wall box... Hm... Easier than glass. Either that or a plastic box, larger than I have. Or, metal box. + +\textcolor{green!60!blue!70}{ +\subsubsection{Breaking the Actuator}} +Actuators are like brushed motors, in that there is a connection from the coil. I have a jigsaw with two brushes on the side. They are these carbon blocks. Actuators are the same, yet the spring is the brush. + +Today I was assembling everything for final deployment, and I accidentally hit the spring with a screwdriver. The spring broke, and I was unable to find a replacement in my box of springs. + +Replacement part needed. It also turns out that the actuator wasn't really loud enough. I'm goint to spec one that is a bit stronger. I've purchased a 1Amp rated one, instead of a 300mA rated one. + +Other than that, everything is built. +\\ + +\includegraphics[scale=0.4]{../pics/DSCN2702.JPG} +\captionof{figure}{Early build.} + +\end{document} + diff --git a/Attiny_Solar_Energy_Harvest/docs/2.aux b/Attiny_Solar_Energy_Harvest/docs/2.aux new file mode 100644 index 0000000..6cbdfad --- /dev/null +++ b/Attiny_Solar_Energy_Harvest/docs/2.aux @@ -0,0 +1,5 @@ +\relax +\@writefile{toc}{\contentsline {section}{\numberline {1}Attiny Solar Energy Harvest Tests}{1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Micro Considerations}{1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Energy Storage}{1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.3}Make parts, not scrap}{1}} diff --git a/Attiny_Solar_Energy_Harvest/docs/2.log b/Attiny_Solar_Energy_Harvest/docs/2.log new file mode 100644 index 0000000..b3670d6 --- /dev/null +++ b/Attiny_Solar_Energy_Harvest/docs/2.log @@ -0,0 +1,272 @@ +This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex 2019.8.17) 23 MAR 2020 00:43 +entering extended mode + restricted \write18 enabled. + %&-line parsing enabled. +**/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/ +Attiny_Solar_Energy_Harvest/docs/2.tex + +(/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/A +ttiny_Solar_Energy_Harvest/docs/2.tex +LaTeX2e <2017/01/01> patch level 3 +Babel <3.9r> and hyphenation patterns for 3 language(s) loaded. +(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls +Document Class: article 2014/09/29 v1.4h Standard LaTeX document class +(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo +File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) +) +\c@part=\count79 +\c@section=\count80 +\c@subsection=\count81 +\c@subsubsection=\count82 +\c@paragraph=\count83 +\c@subparagraph=\count84 +\c@figure=\count85 +\c@table=\count86 +\abovecaptionskip=\skip41 +\belowcaptionskip=\skip42 +\bibindent=\dimen102 +) +(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty +Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) + +(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty +Package: keyval 2014/10/28 v1.15 key=value parser (DPC) +\KV@toks@=\toks14 +) +(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty +Package: graphics 2016/10/09 v1.0u Standard LaTeX Graphics (DPC,SPQR) + +(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty +Package: trig 2016/01/03 v1.10 sin cos tan (DPC) +) +(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg +File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration +) +Package graphics Info: Driver file: pdftex.def on input line 99. + +(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/pdftex.def +File: pdftex.def 2017/01/12 v0.06k Graphics/color for pdfTeX + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty +Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO) +) +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty +Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO) +) +\Gread@gobject=\count87 +)) +\Gin@req@height=\dimen103 +\Gin@req@width=\dimen104 +) +(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty +Package: caption 2016/02/21 v3.3-144 Customizing captions (AR) + +(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty +Package: caption3 2016/05/22 v1.7-166 caption3 kernel (AR) +Package caption3 Info: TeX engine: e-TeX on input line 67. +\captionmargin=\dimen105 +\captionmargin@=\dimen106 +\captionwidth=\dimen107 +\caption@tempdima=\dimen108 +\caption@indent=\dimen109 +\caption@parindent=\dimen110 +\caption@hangindent=\dimen111 +) +\c@ContinuedFloat=\count88 +) +(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty +Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK) + +(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg +File: color.cfg 2016/01/02 v1.6 sample color configuration +) +Package xcolor Info: Driver file: pdftex.def on input line 225. +Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1348. +Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1352. +Package xcolor Info: Model `RGB' extended on input line 1364. +Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366. +Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367. +Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368. +Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369. +Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370. +Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371. +) +(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty +Package: geometry 2010/09/12 v5.6 Page Geometry + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty +Package: ifpdf 2016/05/14 v3.1 Provides the ifpdf switch +) +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty +Package: ifvtex 2016/05/16 v1.6 Detect VTeX and its facilities (HO) +Package ifvtex Info: VTeX not detected. +) +(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty +Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional +) +\Gm@cnth=\count89 +\Gm@cntv=\count90 +\c@Gm@tempcnt=\count91 +\Gm@bindingoffset=\dimen112 +\Gm@wd@mp=\dimen113 +\Gm@odd@mp=\dimen114 +\Gm@even@mp=\dimen115 +\Gm@layoutwidth=\dimen116 +\Gm@layoutheight=\dimen117 +\Gm@layouthoffset=\dimen118 +\Gm@layoutvoffset=\dimen119 +\Gm@dimlist=\toks15 +) (./2.aux) +\openout1 = `2.aux'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 12. +LaTeX Font Info: ... okay on input line 12. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 12. +LaTeX Font Info: ... okay on input line 12. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 12. +LaTeX Font Info: ... okay on input line 12. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 12. +LaTeX Font Info: ... okay on input line 12. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 12. +LaTeX Font Info: ... okay on input line 12. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 12. +LaTeX Font Info: ... okay on input line 12. + +(/usr/share/texlive/texmf-dist/tex/context/base/mkii/supp-pdf.mkii +[Loading MPS to PDF converter (version 2006.09.02).] +\scratchcounter=\count92 +\scratchdimen=\dimen120 +\scratchbox=\box26 +\nofMPsegments=\count93 +\nofMParguments=\count94 +\everyMPshowfont=\toks16 +\MPscratchCnt=\count95 +\MPscratchDim=\dimen121 +\MPnumerator=\count96 +\makeMPintoPDFobject=\count97 +\everyMPtoPDFconversion=\toks17 +) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty +Package: pdftexcmds 2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO +) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty +Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO) +Package ifluatex Info: LuaTeX not detected. +) +Package pdftexcmds Info: LuaTeX not detected. +Package pdftexcmds Info: \pdf@primitive is available. +Package pdftexcmds Info: \pdf@ifprimitive is available. +Package pdftexcmds Info: \pdfdraftmode found. +) +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty +Package: epstopdf-base 2016/05/15 v2.6 Base part for package epstopdf + +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty +Package: grfext 2016/05/16 v1.2 Manage graphics extensions (HO) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty +Package: kvdefinekeys 2016/05/16 v1.4 Define keys (HO) +)) +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty +Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty +Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty +Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO) +Package etexcmds Info: Could not find \expanded. +(etexcmds) That can mean that you are not using pdfTeX 1.50 or +(etexcmds) that some package has redefined \expanded. +(etexcmds) In the latter case, load this package earlier. +))) +Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4 +38. +Package grfext Info: Graphics extension search list: +(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE +G,.JBIG2,.JB2,.eps] +(grfext) \AppendGraphicsExtensions on input line 456. + +(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg +File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv +e +)) +Package caption Info: Begin \AtBeginDocument code. +Package caption Info: End \AtBeginDocument code. + +*geometry* detected driver: dvips +*geometry* verbose mode - [ preamble ] result: +* driver: dvips +* paper: custom +* layout: +* layoutoffset:(h,v)=(0.0pt,0.0pt) +* vratio: 1:1 +* modes: +* h-part:(L,W,R)=(54.2025pt, 325.215pt, 54.2025pt) +* v-part:(T,H,B)=(79.49689pt, 491.43622pt, 79.49689pt) +* \paperwidth=433.62pt +* \paperheight=650.43pt +* \textwidth=325.215pt +* \textheight=491.43622pt +* \oddsidemargin=-18.06749pt +* \evensidemargin=-18.06749pt +* \topmargin=-29.7731pt +* \headheight=12.0pt +* \headsep=25.0pt +* \topskip=11.0pt +* \footskip=30.0pt +* \marginparwidth=59.0pt +* \marginparsep=10.0pt +* \columnsep=10.0pt +* \skip\footins=10.0pt plus 4.0pt minus 2.0pt +* \hoffset=0.0pt +* \voffset=0.0pt +* \mag=1000 +* \@twocolumnfalse +* \@twosidefalse +* \@mparswitchfalse +* \@reversemarginfalse +* (1in=72.27pt=25.4mm, 1cm=28.453pt) + +LaTeX Font Info: Try loading font information for OMS+cmr on input line 22. +(/usr/share/texlive/texmf-dist/tex/latex/base/omscmr.fd +File: omscmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions +) +LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <10.95> not available +(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 22. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <10.95> on input line 34. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <8> on input line 34. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <6> on input line 34. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <9> on input line 34. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <5> on input line 34. + [1 +Non-PDF special ignored! + +{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] +(./2.aux) ) +Here is how much of TeX's memory you used: + 3522 strings out of 494945 + 53529 string characters out of 6181032 + 118046 words of memory out of 5000000 + 6801 multiletter control sequences out of 15000+600000 + 8501 words of font info for 30 fonts, out of 8000000 for 9000 + 14 hyphenation exceptions out of 8191 + 39i,8n,38p,487b,151s stack positions out of 5000i,500n,10000p,200000b,80000s + +Output written on 2.pdf (1 page, 69012 bytes). +PDF statistics: + 32 PDF objects out of 1000 (max. 8388607) + 22 compressed objects within 1 object stream + 0 named destinations out of 1000 (max. 500000) + 1 words of extra memory for PDF output out of 10000 (max. 10000000) + diff --git a/Attiny_Solar_Energy_Harvest/docs/2.pdf b/Attiny_Solar_Energy_Harvest/docs/2.pdf new file mode 100644 index 0000000..48d37ce Binary files /dev/null and b/Attiny_Solar_Energy_Harvest/docs/2.pdf differ diff --git a/Attiny_Solar_Energy_Harvest/docs/2.tex b/Attiny_Solar_Energy_Harvest/docs/2.tex new file mode 100644 index 0000000..65dd185 --- /dev/null +++ b/Attiny_Solar_Energy_Harvest/docs/2.tex @@ -0,0 +1,41 @@ + +\documentclass[11pt]{article} +%Gummi|065|=) +\usepackage{graphicx} +\usepackage{caption} +\usepackage{xcolor} +\usepackage[vcentering,dvips]{geometry} +\geometry{papersize={6in,9in},total={4.5in,6.8in}} +%\title{\textbf{Door Alarm}} +\author{Steak Electronics} +\date{} +\begin{document} + +%\maketitle + +%\tableofcontents +\textcolor{green!60!blue!70}{ + \section{Attiny Solar Energy Harvest Tests}} + +I have the following: +\begin{itemize} +\item Solar panels +\item Attiny 10 +\end{itemize} +To this list, I will add a supercap, and an energy harvesting IC. The goal being to load the super cap during the day, and to run 24/7. I will need an exceptionally low power micro. The super cap will need to be about 3.3V or 5V. +\textcolor{green!60!blue!70}{ +\subsection{Micro Considerations}} +The Arduino Atmega328P is not an option. I'm looking to have a current draw of only 1mA max, (ideally 500uA) when active. Moteino is also not an option for this. Those are made for batteries. I want to be battery free. A super cap, however can be used to store energy. I'll get to that shortly. + +For micros, I have some Attiny10 on hand, and these have a reasonably low power pull in active mode. Let's build those up first. What will the micro do? No idea. I haven't a clue. + +\textcolor{green!60!blue!70}{ +\subsection{Energy Storage}} +I don't want a battery. Let's go with a super cap. The solar panels will only be active some of the time, so I will want to harvest energy with some kind of IC into the cap when the sun is out.\footnote{Reference: www.analog.com/media/en/technical-documentation/technical-articles/solarenergyharvesting.pdf is a start. I'll need to do more research.} + +\textcolor{green!60!blue!70}{ +\subsection{Make parts, not scrap}} +I will want to make sure that all parts I build are perf board parts, not breadboard scrap (to be torn down and rebuilt again). This is an Attiny, so no need to test much, yet. + +\end{document} + diff --git a/Attiny_Solar_Energy_Harvest/docs/2.tex~ b/Attiny_Solar_Energy_Harvest/docs/2.tex~ new file mode 100644 index 0000000..0216ced --- /dev/null +++ b/Attiny_Solar_Energy_Harvest/docs/2.tex~ @@ -0,0 +1,38 @@ + +\documentclass[11pt]{article} +%Gummi|065|=) +\usepackage{graphicx} +\usepackage{caption} +\usepackage{xcolor} +\usepackage[vcentering,dvips]{geometry} +\geometry{papersize={6in,9in},total={4.5in,6.8in}} +\title{\textbf{Door Alarm}} +\author{Steak Electronics} +\date{} +\begin{document} + +\maketitle + +%\tableofcontents +\textcolor{green!60!blue!70}{ + \section{Attiny Solar Energy Harvest Tests}} + +I have the following: +\begin{itemize} +\item Solar panels +\item Attiny 10 +\end{itemize} +To this list, I will add a supercap, and an energy harvesting IC. The goal being to load the super cap during the day, and to run 24/7. I will need an exceptionally low power micro. The super cap will need to be about 3.3V or 5V. + +\subsection{Micro Considerations} +The Arduino Atmega328P is not an option. I'm looking to have a current draw of only 1mA max, (ideally 500uA) when active. Moteino is also not an option for this. Those are made for batteries. I want to be battery free. A super cap, however can be used to store energy. I'll get to that shortly. + +For micros, I have some Attiny10 on hand, and these have a reasonably low power pull in active mode. Let's build those up first. What will the micro do? No idea. I haven't a clue. + +\subsection{Energy Storage} +I don't want a battery. Let's go with a super cap. The solar panels will only be active some of the time, so I will want to harvest energy with some kind of IC into the cap when the sun is out.\footnote{Reference: www.analog.com/media/en/technical-documentation/technical-articles/solarenergyharvesting.pdf is a start. I'll need to do more research.} + + + +\end{document} + diff --git a/Attiny_Solar_Energy_Harvest/docs/3.aux b/Attiny_Solar_Energy_Harvest/docs/3.aux new file mode 100644 index 0000000..a94db2e --- /dev/null +++ b/Attiny_Solar_Energy_Harvest/docs/3.aux @@ -0,0 +1,6 @@ +\relax +\@writefile{toc}{\contentsline {section}{\numberline {1}Attiny Solar Energy Harvest Tests}{1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Micro Considerations}{1}} +\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.1}Micro Notes}{1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Energy Storage}{1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.3}Make parts, not scrap}{2}} diff --git a/Attiny_Solar_Energy_Harvest/docs/3.log b/Attiny_Solar_Energy_Harvest/docs/3.log new file mode 100644 index 0000000..7eb1482 --- /dev/null +++ b/Attiny_Solar_Energy_Harvest/docs/3.log @@ -0,0 +1,283 @@ +This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex 2019.8.17) 23 MAR 2020 00:46 +entering extended mode + restricted \write18 enabled. + %&-line parsing enabled. +**/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/ +Attiny_Solar_Energy_Harvest/docs/3.tex + +(/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/A +ttiny_Solar_Energy_Harvest/docs/3.tex +LaTeX2e <2017/01/01> patch level 3 +Babel <3.9r> and hyphenation patterns for 3 language(s) loaded. +(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls +Document Class: article 2014/09/29 v1.4h Standard LaTeX document class +(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo +File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) +) +\c@part=\count79 +\c@section=\count80 +\c@subsection=\count81 +\c@subsubsection=\count82 +\c@paragraph=\count83 +\c@subparagraph=\count84 +\c@figure=\count85 +\c@table=\count86 +\abovecaptionskip=\skip41 +\belowcaptionskip=\skip42 +\bibindent=\dimen102 +) +(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty +Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) + +(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty +Package: keyval 2014/10/28 v1.15 key=value parser (DPC) +\KV@toks@=\toks14 +) +(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty +Package: graphics 2016/10/09 v1.0u Standard LaTeX Graphics (DPC,SPQR) + +(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty +Package: trig 2016/01/03 v1.10 sin cos tan (DPC) +) +(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg +File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration +) +Package graphics Info: Driver file: pdftex.def on input line 99. + +(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/pdftex.def +File: pdftex.def 2017/01/12 v0.06k Graphics/color for pdfTeX + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty +Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO) +) +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty +Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO) +) +\Gread@gobject=\count87 +)) +\Gin@req@height=\dimen103 +\Gin@req@width=\dimen104 +) +(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty +Package: caption 2016/02/21 v3.3-144 Customizing captions (AR) + +(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty +Package: caption3 2016/05/22 v1.7-166 caption3 kernel (AR) +Package caption3 Info: TeX engine: e-TeX on input line 67. +\captionmargin=\dimen105 +\captionmargin@=\dimen106 +\captionwidth=\dimen107 +\caption@tempdima=\dimen108 +\caption@indent=\dimen109 +\caption@parindent=\dimen110 +\caption@hangindent=\dimen111 +) +\c@ContinuedFloat=\count88 +) +(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty +Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK) + +(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg +File: color.cfg 2016/01/02 v1.6 sample color configuration +) +Package xcolor Info: Driver file: pdftex.def on input line 225. +Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1348. +Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1352. +Package xcolor Info: Model `RGB' extended on input line 1364. +Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366. +Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367. +Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368. +Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369. +Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370. +Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371. +) +(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty +Package: geometry 2010/09/12 v5.6 Page Geometry + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty +Package: ifpdf 2016/05/14 v3.1 Provides the ifpdf switch +) +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty +Package: ifvtex 2016/05/16 v1.6 Detect VTeX and its facilities (HO) +Package ifvtex Info: VTeX not detected. +) +(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty +Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional +) +\Gm@cnth=\count89 +\Gm@cntv=\count90 +\c@Gm@tempcnt=\count91 +\Gm@bindingoffset=\dimen112 +\Gm@wd@mp=\dimen113 +\Gm@odd@mp=\dimen114 +\Gm@even@mp=\dimen115 +\Gm@layoutwidth=\dimen116 +\Gm@layoutheight=\dimen117 +\Gm@layouthoffset=\dimen118 +\Gm@layoutvoffset=\dimen119 +\Gm@dimlist=\toks15 +) (./3.aux) +\openout1 = `3.aux'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 12. +LaTeX Font Info: ... okay on input line 12. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 12. +LaTeX Font Info: ... okay on input line 12. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 12. +LaTeX Font Info: ... okay on input line 12. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 12. +LaTeX Font Info: ... okay on input line 12. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 12. +LaTeX Font Info: ... okay on input line 12. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 12. +LaTeX Font Info: ... okay on input line 12. + +(/usr/share/texlive/texmf-dist/tex/context/base/mkii/supp-pdf.mkii +[Loading MPS to PDF converter (version 2006.09.02).] +\scratchcounter=\count92 +\scratchdimen=\dimen120 +\scratchbox=\box26 +\nofMPsegments=\count93 +\nofMParguments=\count94 +\everyMPshowfont=\toks16 +\MPscratchCnt=\count95 +\MPscratchDim=\dimen121 +\MPnumerator=\count96 +\makeMPintoPDFobject=\count97 +\everyMPtoPDFconversion=\toks17 +) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty +Package: pdftexcmds 2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO +) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty +Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO) +Package ifluatex Info: LuaTeX not detected. +) +Package pdftexcmds Info: LuaTeX not detected. +Package pdftexcmds Info: \pdf@primitive is available. +Package pdftexcmds Info: \pdf@ifprimitive is available. +Package pdftexcmds Info: \pdfdraftmode found. +) +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty +Package: epstopdf-base 2016/05/15 v2.6 Base part for package epstopdf + +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty +Package: grfext 2016/05/16 v1.2 Manage graphics extensions (HO) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty +Package: kvdefinekeys 2016/05/16 v1.4 Define keys (HO) +)) +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty +Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty +Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty +Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO) +Package etexcmds Info: Could not find \expanded. +(etexcmds) That can mean that you are not using pdfTeX 1.50 or +(etexcmds) that some package has redefined \expanded. +(etexcmds) In the latter case, load this package earlier. +))) +Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4 +38. +Package grfext Info: Graphics extension search list: +(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE +G,.JBIG2,.JB2,.eps] +(grfext) \AppendGraphicsExtensions on input line 456. + +(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg +File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv +e +)) +Package caption Info: Begin \AtBeginDocument code. +Package caption Info: End \AtBeginDocument code. + +*geometry* detected driver: dvips +*geometry* verbose mode - [ preamble ] result: +* driver: dvips +* paper: custom +* layout: +* layoutoffset:(h,v)=(0.0pt,0.0pt) +* vratio: 1:1 +* modes: +* h-part:(L,W,R)=(54.2025pt, 325.215pt, 54.2025pt) +* v-part:(T,H,B)=(79.49689pt, 491.43622pt, 79.49689pt) +* \paperwidth=433.62pt +* \paperheight=650.43pt +* \textwidth=325.215pt +* \textheight=491.43622pt +* \oddsidemargin=-18.06749pt +* \evensidemargin=-18.06749pt +* \topmargin=-29.7731pt +* \headheight=12.0pt +* \headsep=25.0pt +* \topskip=11.0pt +* \footskip=30.0pt +* \marginparwidth=59.0pt +* \marginparsep=10.0pt +* \columnsep=10.0pt +* \skip\footins=10.0pt plus 4.0pt minus 2.0pt +* \hoffset=0.0pt +* \voffset=0.0pt +* \mag=1000 +* \@twocolumnfalse +* \@twosidefalse +* \@mparswitchfalse +* \@reversemarginfalse +* (1in=72.27pt=25.4mm, 1cm=28.453pt) + +LaTeX Font Info: Try loading font information for OMS+cmr on input line 22. +(/usr/share/texlive/texmf-dist/tex/latex/base/omscmr.fd +File: omscmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions +) +LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <10.95> not available +(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 22. + +Underfull \hbox (badness 10000) in paragraph at lines 34--37 + + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 34--37 + + [] + +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <10.95> on input line 41. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <8> on input line 41. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <6> on input line 41. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <9> on input line 41. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <5> on input line 41. +[1 +Non-PDF special ignored! + +{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] +[2] (./3.aux) ) +Here is how much of TeX's memory you used: + 3524 strings out of 494945 + 53553 string characters out of 6181032 + 118046 words of memory out of 5000000 + 6802 multiletter control sequences out of 15000+600000 + 8809 words of font info for 31 fonts, out of 8000000 for 9000 + 14 hyphenation exceptions out of 8191 + 39i,8n,38p,487b,200s stack positions out of 5000i,500n,10000p,200000b,80000s + +Output written on 3.pdf (2 pages, 80459 bytes). +PDF statistics: + 39 PDF objects out of 1000 (max. 8388607) + 27 compressed objects within 1 object stream + 0 named destinations out of 1000 (max. 500000) + 1 words of extra memory for PDF output out of 10000 (max. 10000000) + diff --git a/Attiny_Solar_Energy_Harvest/docs/3.pdf b/Attiny_Solar_Energy_Harvest/docs/3.pdf new file mode 100644 index 0000000..3b85680 Binary files /dev/null and b/Attiny_Solar_Energy_Harvest/docs/3.pdf differ diff --git a/Attiny_Solar_Energy_Harvest/docs/3.tex b/Attiny_Solar_Energy_Harvest/docs/3.tex new file mode 100644 index 0000000..35a562d --- /dev/null +++ b/Attiny_Solar_Energy_Harvest/docs/3.tex @@ -0,0 +1,48 @@ + +\documentclass[11pt]{article} +%Gummi|065|=) +\usepackage{graphicx} +\usepackage{caption} +\usepackage{xcolor} +\usepackage[vcentering,dvips]{geometry} +\geometry{papersize={6in,9in},total={4.5in,6.8in}} +%\title{\textbf{Door Alarm}} +\author{Steak Electronics} +\date{} +\begin{document} + +%\maketitle + +%\tableofcontents +\textcolor{green!60!blue!70}{ + \section{Attiny Solar Energy Harvest Tests}} + +I have the following: +\begin{itemize} +\item Solar panels +\item Attiny 10 +\end{itemize} +To this list, I will add a supercap, and an energy harvesting IC. The goal being to load the super cap during the day, and to run 24/7. I will need an exceptionally low power micro. The super cap will need to be about 3.3V or 5V. +\textcolor{green!60!blue!70}{ +\subsection{Micro Considerations}} +The Arduino Atmega328P is not an option. I'm looking to have a current draw of only 1mA max, (ideally 500uA) when active. Moteino is also not an option for this. Those are made for batteries. I want to be battery free. A super cap, however can be used to store energy. I'll get to that shortly. + +For micros, I have some Attiny10 on hand, and these have a reasonably low power pull in active mode. Let's build those up first. What will the micro do? No idea. I haven't a clue. + +\textcolor{green!60!blue!70}{ +\subsubsection{Micro Notes}} +Must run at 1.8V / 1MHz per front page of data sheet, for 200uA draw in active mode. +\\ +\\ + + +\textcolor{green!60!blue!70}{ +\subsection{Energy Storage}} +I don't want a battery. Let's go with a super cap. The solar panels will only be active some of the time, so I will want to harvest energy with some kind of IC into the cap when the sun is out.\footnote{Reference: www.analog.com/media/en/technical-documentation/technical-articles/solarenergyharvesting.pdf is a start. I'll need to do more research.} + +\textcolor{green!60!blue!70}{ +\subsection{Make parts, not scrap}} +I will want to make sure that all parts I build are perf board parts, not breadboard scrap (to be torn down and rebuilt again). This is an Attiny, so no need to test much, yet. + +\end{document} + diff --git a/Attiny_Solar_Energy_Harvest/docs/3.tex~ b/Attiny_Solar_Energy_Harvest/docs/3.tex~ new file mode 100644 index 0000000..65dd185 --- /dev/null +++ b/Attiny_Solar_Energy_Harvest/docs/3.tex~ @@ -0,0 +1,41 @@ + +\documentclass[11pt]{article} +%Gummi|065|=) +\usepackage{graphicx} +\usepackage{caption} +\usepackage{xcolor} +\usepackage[vcentering,dvips]{geometry} +\geometry{papersize={6in,9in},total={4.5in,6.8in}} +%\title{\textbf{Door Alarm}} +\author{Steak Electronics} +\date{} +\begin{document} + +%\maketitle + +%\tableofcontents +\textcolor{green!60!blue!70}{ + \section{Attiny Solar Energy Harvest Tests}} + +I have the following: +\begin{itemize} +\item Solar panels +\item Attiny 10 +\end{itemize} +To this list, I will add a supercap, and an energy harvesting IC. The goal being to load the super cap during the day, and to run 24/7. I will need an exceptionally low power micro. The super cap will need to be about 3.3V or 5V. +\textcolor{green!60!blue!70}{ +\subsection{Micro Considerations}} +The Arduino Atmega328P is not an option. I'm looking to have a current draw of only 1mA max, (ideally 500uA) when active. Moteino is also not an option for this. Those are made for batteries. I want to be battery free. A super cap, however can be used to store energy. I'll get to that shortly. + +For micros, I have some Attiny10 on hand, and these have a reasonably low power pull in active mode. Let's build those up first. What will the micro do? No idea. I haven't a clue. + +\textcolor{green!60!blue!70}{ +\subsection{Energy Storage}} +I don't want a battery. Let's go with a super cap. The solar panels will only be active some of the time, so I will want to harvest energy with some kind of IC into the cap when the sun is out.\footnote{Reference: www.analog.com/media/en/technical-documentation/technical-articles/solarenergyharvesting.pdf is a start. I'll need to do more research.} + +\textcolor{green!60!blue!70}{ +\subsection{Make parts, not scrap}} +I will want to make sure that all parts I build are perf board parts, not breadboard scrap (to be torn down and rebuilt again). This is an Attiny, so no need to test much, yet. + +\end{document} + diff --git a/Attiny_Solar_Energy_Harvest/resources/ATTiny4_5_9_10_20_40_Programmer.jar b/Attiny_Solar_Energy_Harvest/resources/ATTiny4_5_9_10_20_40_Programmer.jar new file mode 100644 index 0000000..6f46c4d Binary files /dev/null and b/Attiny_Solar_Energy_Harvest/resources/ATTiny4_5_9_10_20_40_Programmer.jar differ diff --git a/Attiny_Solar_Energy_Harvest/resources/ATtiny4_5_9_10_20_40Programmer.ino b/Attiny_Solar_Energy_Harvest/resources/ATtiny4_5_9_10_20_40Programmer.ino new file mode 100644 index 0000000..85ad797 --- /dev/null +++ b/Attiny_Solar_Energy_Harvest/resources/ATtiny4_5_9_10_20_40Programmer.ino @@ -0,0 +1,894 @@ +/************************************************** + * TPI programmer for ATtiny4/5/9/10/20/40 + * + * Make the connections as shown below. + * + * To use: + ***** Buad rate must be set to 9600 **** + * + * - Upload to arduino and power off + * - Connect ATtiny10 as shown + * - Power on and open the serial monitor + * - If things are working so far you should + * see "NVM enabled" and "ATtiny10/20/40 connected". + * - Input one-letter commands via serial monitor: + * + * D = dump memory. Displays all current memory + * on the chip + * + * E = erase chip. Erases all program memory + * automatically done at time of programming + * + * P = write program. After sending this, paste + * the program from the hex file into the + * serial monitor. + * + * S = set fuse. follow the instructions to set + * one of the three fuses. + * + * C = clear fuse. follow the instructions to clear + * one of the three fuses. + * + * L = Set Lock Bits No further programming & verification + * possible + * + * H = Toggle High Voltage Programming + * + * T = Toggle +12v enabled by High, or Low + * + * R/r = Quick reset + * + * - Finally, power off the arduino and remove the + * Attiny10/20/40 + * + * + * Arduino ATtiny10 * + * ----------+ +---------------- * + * (SS#) 10 |--[R]-----| 6 (RESET#/PB3) * + * | | * + * (MOSI) 11 |--[R]--+--| 1 (TPIDATA/PB0) * + * | | | * + * (MISO) 12 |--[R]--+ | * + * | | * + * (SCK) 13 |--[R]-----| 3 (TPICLK/PB1) * + * ----------+ +---------------- * + * * + * ----------+ +---------------- * + * (HVP) 9 |--- | 6 (RESET#/PB3) * + * | | * + * * + * -[R]- = a 220 - 1K Ohm resistor * + * * + * this picture : 2011/12/08 by pcm1723 * + * modified :2015/02/27 by KD * + * * + * thanks to pcm1723 for tpitest.pde upon which * + * this is based * + ************************************************** + Updates: + + Apr 02, 2018: Ksdsksd@gmail.com + * Added Lock bit setting to main menu + + Jan 23, 2017: Ksdsksd@gmail.com + * Thanks to InoueTaichi Fixed incorrect #define Tiny40 + + Mar 05, 2015: Ksdsksd@gamil.com + * Added notifications to setting and clearing the system flags. + + Feb 23, 2015: Ksdsksd@gamil.com + * Changed the programmer Diagram, This is the config I use, and get a sucessful programming of a tiny10 at 9600 baud. + + Mar 22, 2014: Ksdsksd@gmail.com + * Added the quick reset to high before resetting the device. + * Added code to stop the SPI and float the pins for testing the device while connected. + + Mar 20, 2014: Ksdsksd@gmail.com + * Added a quick reset by sending 'r' or 'R' via the serial monitor. + * Added a High voltage programming option from pin 9, toggled by 'H' + * Added a High/low option for providing 12v to the reset pin, toggled by 'T' + + Mar 17, 2014: Ksdsksd@gmail.com + * Had some trouble with the nibbles being swapped when programming on the 10 & 20, + added b1,b2 to hold the serial data before calling byteval() + * Added Nat Blundell's patch to the code + + Apr 10, 2013: Ksdsksd@gmail.com + * Applied Fix for setting and clearing flags + + Feb 7, 2013: Ksdsksd@gmail.com + * Fixed programming timer, had intitial start at zero instead of current time. + + Dec 11, 2012: Ksdsksd@gmail.com + * Added detect and programming for 4/5/9 + + Dec 5-6, 2012: Ksdsksd@gmail.com + * Incorperated read, and verify into program. Now have no program size limitation by using 328p. + * Changed the outHex routines consolidated them into 1, number to be printed, and number of nibbles + * Added a type check to distinguish between Tiny10/20/40 + * Added an auto word size check to ensure that there is the proper amount of words written for a 10/20/40 + * Removed Read program, Verify, and Finish from options + * Changed baud rate to 19200 for delay from data written to the chip, to prevent serial buffer overrun. + + Oct 5, 2012: Ksdsksd@gmail.com + *** Noticed that when programming, the verification fails + at times by last 1-2 bytes programmed, and the Tiny would act erratic. + Quick fix was adding 3 NOP's to the end the Tiny's code, and ignoring the errors, the Tiny then performed as expected. + + Oct 4, 2012: Ksdsksd@gmail.com + * Moved all Serial printed strings to program space + * Added code to detect Tiny20 +*/ + +#include +#include "pins_arduino.h" + +// define the instruction set bytes +#define SLD 0x20 +#define SLDp 0x24 +#define SST 0x60 +#define SSTp 0x64 +#define SSTPRH 0x69 +#define SSTPRL 0x68 +// see functions below //////////////////////////////// +// SIN 0b0aa1aaaa replace a with 6 address bits +// SOUT 0b1aa1aaaa replace a with 6 address bits +// SLDCS 0b1000aaaa replace a with address bits +// SSTCS 0b1100aaaa replace a with address bits +/////////////////////////////////////////////////////// +#define SKEY 0xE0 +#define NVM_PROGRAM_ENABLE 0x1289AB45CDD888FFULL // the ULL means unsigned long long + +#define NVMCMD 0x33 +#define NVMCSR 0x32 +#define NVM_NOP 0x00 +#define NVM_CHIP_ERASE 0x10 +#define NVM_SECTION_ERASE 0x14 +#define NVM_WORD_WRITE 0x1D + +#define HVReset 9 + +#define Tiny4_5 10 +#define Tiny9 1 +#define Tiny10 1 +#define Tiny20 2 +#define Tiny40 4 + +#define TimeOut 1 +#define HexError 2 +#define TooLarge 3 +// represents the current pointer register value +unsigned short adrs = 0x0000; + +// used for storing a program file +uint8_t data[16]; //program data +unsigned int progSize = 0; //program size in bytes + +// used for various purposes +long startTime; +int timeout; +uint8_t b, b1, b2, b3; +boolean idChecked; +boolean correct; +char type; // type of chip connected 1 = Tiny10, 2 = Tiny20 +char HVP = 0; +char HVON = 0; + +void setup(){ + // set up serial + Serial.begin(9600); // you cant increase this, it'll overrun the buffer + // set up SPI +/* SPI.begin(); + SPI.setBitOrder(LSBFIRST); + SPI.setDataMode(SPI_MODE0); + SPI.setClockDivider(SPI_CLOCK_DIV32); + +*/ start_tpi(); + + + pinMode(HVReset, OUTPUT); + // initialize memory pointer register + setPointer(0x0000); + + timeout = 20000; + idChecked = false; +} // end setup() + + +void hvserial() +{ + if(HVP) + Serial.println(F("***High Voltage Programming Enabled***")); + else + Serial.println(F("High Voltage Programming Disabled")); + + Serial.print(F("Pin 9 ")); + Serial.print(HVON?F("HIGH"):F("LOW")); + Serial.print(F(" supplies 12v")); + +} + + +void hvReset(char highLow) +{ + if(HVP) + { + if(HVON) //if high enables 12v + highLow = !highLow; // invert the typical reset + digitalWrite(HVReset, highLow); + } + else + digitalWrite(SS, highLow); +} + +void quickReset() +{ + digitalWrite(SS,HIGH); + delay(1); + digitalWrite(SS,LOW); + delay(10); + digitalWrite(SS,HIGH); +} + +void start_tpi() { + SPI.begin(); + SPI.setBitOrder(LSBFIRST); + SPI.setDataMode(SPI_MODE0); + SPI.setClockDivider(SPI_CLOCK_DIV32); + + // enter TPI programming mode + hvReset(LOW); +// digitalWrite(SS, LOW); // assert RESET on tiny + delay(1); // t_RST min = 400 ns @ Vcc = 5 V + + SPI.transfer(0xff); // activate TPI by emitting + SPI.transfer(0xff); // 16 or more pulses on TPICLK + SPI.transfer(0xff); // while holding TPIDATA to "1" + + writeCSS(0x02, 0x04); // TPIPCR, guard time = 8bits (default=128) + + send_skey(NVM_PROGRAM_ENABLE); // enable NVM interface + // wait for NVM to be enabled + while((readCSS(0x00) & 0x02) < 1){ + // wait + } + Serial.println(F("NVM enabled")); +} + +void setLockBits(){ + + Serial.print(F("Locking... Are you sure? Y/N")); + while(Serial.available() < 1); + char yn = Serial.read(); + if(yn == 'n' || yn == 'N') + return; + + setPointer(0x3F00); + writeIO(NVMCMD, NVM_WORD_WRITE); + tpi_send_byte(SSTp); + tpi_send_byte(0); + + tpi_send_byte(SSTp); + tpi_send_byte(0xFF); + + + while((readIO(NVMCSR) & (1<<7)) != 0x00); + Serial.print(F("Locked...")); +} + +void loop(){ + if(!idChecked){ +// start_tpi(); + checkID(); + idChecked = true; + finish(); + } + // when ready, send ready signal '.' and wait + Serial.print(F("\n>")); + while(Serial.available() < 1){ + // wait + } + start_tpi(); + + // the first byte is a command + //** 'P' = program the ATtiny using the read program + //** 'D' = dump memory to serial monitor + //** 'E' = erase chip. erases current program memory.(done automatically by 'P') + //** 'S' = set fuse + //** 'C' = clear fuse + //** 'L' = Set Lock Bits + + char comnd = Sread(); + + switch( comnd ){ + case 'r': + case'R': + quickReset(); + break; + + case 'D': + dumpMemory(); + break; + + case 'H': + HVP = !HVP; + hvserial(); + break; + + case 'T': + HVON = !HVON; + hvserial(); + break; + + + case 'P': + if(!writeProgram()){ + startTime = millis(); + while(millis()-startTime < 8000) + Serial.read();// if exited due to error, disregard all other serial data + } + + break; + + case 'E': + eraseChip(); + break; + + case 'S': + setConfig(true); + break; + + case 'C': + setConfig(false); + break; + + case 'L': + setLockBits(); + break; + + default: + Serial.println(F("Received unknown command")); + } + + finish(); + + +} +void ERROR_pgmSize(void) +{ + Serial.println(F("program size is 0??")); +} + +void ERROR_data(char i) +{ + Serial.println(F("couldn't receive data:")); + switch(i){ + case TimeOut: + Serial.println(F("timed out")); + break; + case HexError: + Serial.println(F("hex file format error")); + break; + case TooLarge: + Serial.println(F("program is too large")); + break; + + default: + break; + } + +} + + +// print the register, SRAM, config and signature memory +void dumpMemory(){ + unsigned int len; + uint8_t i; + // initialize memory pointer register + setPointer(0x0000); + + Serial.println(F("Current memory state:")); + if(type != Tiny4_5) + len = 0x400 * type; //the memory length for a 10/20/40 is 1024/2048/4096 + else + len = 0x200; //tiny 4/5 has 512 bytes + len += 0x4000; + + while(adrs < len){ + // read the byte at the current pointer address + // and increment address + tpi_send_byte(SLDp); + b = tpi_receive_byte(); // get data byte + + // read all the memory, but only print + // the register, SRAM, config and signature memory + if ((0x0000 <= adrs && adrs <= 0x005F) // register/SRAM + |(0x3F00 <= adrs && adrs <= 0x3F01) // NVM lock bits + |(0x3F40 <= adrs && adrs <= 0x3F41) // config + |(0x3F80 <= adrs && adrs <= 0x3F81) // calibration + |(0x3FC0 <= adrs && adrs <= 0x3FC3) // ID + |(0x4000 <= adrs && adrs <= len-1) ) { // program + // print +number along the top + if ((0x00 == adrs) + |(0x3f00 == adrs) // NVM lock bits + |(0x3F40 == adrs) // config + |(0x3F80 == adrs) // calibration + |(0x3FC0 == adrs) // ID + |(0x4000 == adrs) ) { + Serial.println(); + if(adrs == 0x0000){ Serial.print(F("registers, SRAM")); } + if(adrs == 0x3F00){ Serial.print(F("NVM lock")); } + if(adrs == 0x3F40){ Serial.print(F("configuration")); } + if(adrs == 0x3F80){ Serial.print(F("calibration")); } + if(adrs == 0x3FC0){ Serial.print(F("device ID")); } + if(adrs == 0x4000){ Serial.print(F("program")); } + Serial.println(); + for (i = 0; i < 5; i++) + Serial.print(F(" ")); + for (i = 0; i < 16; i++) { + Serial.print(F(" +")); + Serial.print(i, HEX); + } + } + // print number on the left + if (0 == (0x000f & adrs)) { + Serial.println(); + outHex(adrs, 4); + Serial.print(F(": ")); // delimiter + } + outHex(b, 2); + Serial.print(F(" ")); + } + adrs++; // increment memory address + if(adrs == 0x0060){ + // skip reserved memory + setPointer(0x3F00); + } + } + Serial.println(F(" ")); +} // end dumpMemory() + + +// receive and translate the contents of a hex file, Program and verify on the fly +boolean writeProgram(){ + char datlength[] = "00"; + char addr[] = "0000"; + char something[] = "00"; + char chksm[] = "00"; + unsigned int currentByte = 0; + progSize = 0; + uint8_t linelength = 0; + boolean fileEnd = false; + unsigned short tadrs; + tadrs = adrs = 0x4000; + correct = true; + unsigned long pgmStartTime = millis(); + eraseChip(); // erase chip + char words = (type!=Tiny4_5?type:1); + char b1, b2; + // read in the data and + while(!fileEnd){ + startTime = millis(); + while(Serial.available() < 1){ + if(millis()-startTime > timeout){ + ERROR_data(TimeOut); + return false; + } + if(pgmStartTime == 0) + pgmStartTime = millis(); + } + if(Sread() != ':'){ // maybe it was a newline?? + if(Sread() != ':'){ + ERROR_data(HexError); + return false; + } + } + // read data length + + datlength[0] = Sread(); + datlength[1] = Sread(); + linelength = byteval(datlength[0], datlength[1]); + + // read address. if "0000" currentByte = 0 + addr[0] = Sread(); + addr[1] = Sread(); + addr[2] = Sread(); + addr[3] = Sread(); + if(linelength != 0x00 && addr[0]=='0' && addr[1]=='0' && addr[2]=='0' && addr[3]=='0') + currentByte = 0; + + // read type thingy. "01" means end of file + something[0] = Sread(); + something[1] = Sread(); + if(something[1] == '1'){ + fileEnd = true; + } + + if(something[1] == '2'){ + for (int i = 0; i<=linelength; i++){ + Sread(); + Sread(); + } + + } + else{ + // read in the data + for(int k=0; k timeout){ + ERROR_data(TimeOut); + return false; + } + } + b1=Sread(); + b2=Sread(); + data[currentByte] = byteval(b1, b2); + currentByte++; + progSize++; + if(progSize > (type!=Tiny4_5?type*1024:512)){ + ERROR_data(TooLarge); + return 0; + } + + + if(fileEnd) //has the end of the file been reached? + while(currentByte < 2 * words){// append zeros to align the word count to program + data[currentByte] = 0; + currentByte++; + } + + + + if( currentByte == 2 * words ){// is the word/Dword/Qword here? + + currentByte = 0; // yes, reset counter + setPointer(tadrs); // point to the address to program + writeIO(NVMCMD, NVM_WORD_WRITE); + for(int i = 0; i<2 * words; i+=2){// loop for each word size depending on micro + + // now write a word to program memory + tpi_send_byte(SSTp); + tpi_send_byte(data[i]); // LSB first + tpi_send_byte(SSTp); + tpi_send_byte(data[i+1]); // then MSB + SPI.transfer(0xff); //send idle between words + SPI.transfer(0xff); //send idle between words + } + while((readIO(NVMCSR) & (1<<7)) != 0x00){} // wait for write to finish + + writeIO(NVMCMD, NVM_NOP); + SPI.transfer(0xff); + SPI.transfer(0xff); + + + //verify written words + setPointer(tadrs); + for (int c = 0; c < 2 * words; c++){ + tpi_send_byte(SLDp); + b = tpi_receive_byte(); // get data byte + + if(b != data[c]){ + correct = false; + Serial.println(F("program error:")); + Serial.print(F("byte ")); + outHex(adrs, 4); + Serial.print(F(" expected ")); + outHex(data[c],2); + Serial.print(F(" read ")); + outHex(b,2); + Serial.println(); + + if(!correct) + return false; + } + } + tadrs += 2 * words; + } + } + + // read in the checksum. + startTime = millis(); + while(Serial.available() == 0){ + if(millis()-startTime > timeout){ + ERROR_data(TimeOut); + return false; + } + } + chksm[0] = Sread(); + chksm[1] = Sread(); + + } + } + // the program was successfully written + Serial.print(F("Successfully wrote program: ")); + Serial.print(progSize, DEC); + Serial.print(F(" of ")); + if(type != Tiny4_5) + Serial.print(1024 * type, DEC); + else + Serial.print(512, DEC); + Serial.print(F(" bytes\n in ")); + Serial.print((millis()-pgmStartTime)/1000.0,DEC); + Serial.print(F(" Seconds")); +// digitalWrite(SS, HIGH); // release RESET + + return true; +} + + +void eraseChip(){ + // initialize memory pointer register + setPointer(0x4001); // need the +1 for chip erase + + // erase the chip + writeIO(NVMCMD, NVM_CHIP_ERASE); + tpi_send_byte(SSTp); + tpi_send_byte(0xAA); + tpi_send_byte(SSTp); + tpi_send_byte(0xAA); + tpi_send_byte(SSTp); + tpi_send_byte(0xAA); + tpi_send_byte(SSTp); + tpi_send_byte(0xAA); + while((readIO(NVMCSR) & (1<<7)) != 0x00){ + // wait for erasing to finish + } + Serial.println(F("chip erased")); +} + +void setConfig(boolean val){ + // get current config byte + setPointer(0x3F40); + tpi_send_byte(SLD); + b = tpi_receive_byte(); + + Serial.println(F("input one of these letters")); + Serial.println(F("c = system clock output")); + Serial.println(F("w = watchdog timer on")); + Serial.println(F("r = disable reset")); + Serial.println(F("x = cancel. don't change anything")); + + while(Serial.available() < 1){ + // wait + } + char comnd = Serial.read(); + setPointer(0x3F40); + writeIO(NVMCMD, (val ? NVM_WORD_WRITE : NVM_SECTION_ERASE) ); + + if(comnd == 'c'){ + tpi_send_byte(SSTp); + if(val){ + tpi_send_byte(b & 0b11111011); + }else{ + tpi_send_byte(b | 0x04); + } + tpi_send_byte(SSTp); + tpi_send_byte(0xFF); + }else if(comnd == 'w'){ + tpi_send_byte(SSTp); + if(val){ + tpi_send_byte(b & 0b11111101); + }else{ + tpi_send_byte(b | 0x02); + } + tpi_send_byte(SSTp); + tpi_send_byte(0xFF); + }else if(comnd == 'r'){ + tpi_send_byte(SSTp); + if(val){ + tpi_send_byte(b & 0b11111110); + }else{ + tpi_send_byte(b | 0x01); + } + tpi_send_byte(SSTp); + tpi_send_byte(0xFF); + }else if(comnd == 'x'){ + // do nothing + }else{ + Serial.println(F("received unknown command. Cancelling")); + } + while((readIO(NVMCSR) & (1<<7)) != 0x00){ + // wait for write to finish + } + writeIO(NVMCMD, NVM_NOP); + SPI.transfer(0xff); + SPI.transfer(0xff); + if(comnd != 'x'){ + + Serial.print(F("\n\nSuccessfully ")); + if(val) + Serial.print(F("Set ")); + else + Serial.print(F("Cleared ")); + + Serial.print(F("\"")); + if(comnd == 'w') + Serial.print(F("Watchdog")); + else if(comnd == 'c') + Serial.print(F("Clock Output")); + else if(comnd == 'r') + Serial.print(F("Reset")); + + Serial.println(F("\" Flag\n")); + + } +} + +void finish(){ + writeCSS(0x00, 0x00); + SPI.transfer(0xff); + SPI.transfer(0xff); + hvReset(HIGH); +// digitalWrite(SS, HIGH); // release RESET + delay(1); // t_RST min = 400 ns @ Vcc = 5 V + SPI.end(); + DDRB &= 0b11000011; //tri-state spi so target can be tested + PORTB &= 0b11000011; +} + +void checkID(){ + // check the device ID + uint8_t id1, id2, id3; + setPointer(0x3FC0); + + tpi_send_byte(SLDp); + id1 = tpi_receive_byte(); + tpi_send_byte(SLDp); + id2 = tpi_receive_byte(); + tpi_send_byte(SLDp); + id3 = tpi_receive_byte(); + if(id1==0x1E && id2==0x8F && id3==0x0A){ + Serial.print(F("ATtiny4")); + type = Tiny4_5; + }else if(id1==0x1E && id2==0x8F && id3==0x09){ + Serial.print(F("ATtiny5")); + type = Tiny4_5; + }else if(id1==0x1E && id2==0x90 && id3==0x08){ + Serial.print(F("ATtiny9")); + type = Tiny9; + }else if(id1==0x1E && id2==0x90 && id3==0x03){ + Serial.print(F("ATtiny10")); + type = Tiny10; + }else if(id1==0x1E && id2==0x91 && id3==0x0f){ + Serial.print(F("ATtiny20")); + type = Tiny20; + }else if(id1==0x1E && id2==0x92 && id3==0x0e){ + Serial.print(F("ATtiny40")); + type = Tiny40; + }else{ + Serial.print(F("Unknown chip")); + } + Serial.println(F(" connected")); +} + +/* +* send a byte in one TPI frame (12 bits) +* (1 start + 8 data + 1 parity + 2 stop) +* using 2 SPI data bytes (2 x 8 = 16 clocks) +* (with 4 extra idle bits) +*/ +void tpi_send_byte( uint8_t data ){ + // compute partiy bit + uint8_t par = data; + par ^= (par >> 4); // b[7:4] (+) b[3:0] + par ^= (par >> 2); // b[3:2] (+) b[1:0] + par ^= (par >> 1); // b[1] (+) b[0] + + // REMEMBER: this is in LSBfirst mode and idle is high + // (2 idle) + (1 start bit) + (data[4:0]) + SPI.transfer(0x03 | (data << 3)); + // (data[7:5]) + (1 parity) + (2 stop bits) + (2 idle) + SPI.transfer(0xf0 | (par << 3) | (data >> 5)); +} // end tpi_send_byte() + +/* +* receive TPI 12-bit format byte data +* via SPI 2 bytes (16 clocks) or 3 bytes (24 clocks) +*/ +uint8_t tpi_receive_byte( void ){ + //uint8_t b1, b2, b3; + // keep transmitting high(idle) while waiting for a start bit + do { + b1 = SPI.transfer(0xff); + } while (0xff == b1); + // get (partial) data bits + b2 = SPI.transfer(0xff); + // if the first byte(b1) contains less than 4 data bits + // we need to get a third byte to get the parity and stop bits + if (0x0f == (0x0f & b1)) { + b3 = SPI.transfer(0xff); + } + + // now shift the bits into the right positions + // b1 should hold only idle and start bits = 0b01111111 + while (0x7f != b1) { // data not aligned + b2 <<= 1; // shift left data bits + if (0x80 & b1) { // carry from 1st byte + b2 |= 1; // set bit + } + b1 <<= 1; + b1 |= 0x01; // fill with idle bit (1) + } + // now the data byte is stored in b2 + return( b2 ); +} // end tpi_receive_byte() + +// send the 64 bit NVM key +void send_skey(uint64_t nvm_key){ + tpi_send_byte(SKEY); + while(nvm_key){ + tpi_send_byte(nvm_key & 0xFF); + nvm_key >>= 8; + } +} // end send_skey() + +// sets the pointer address +void setPointer(unsigned short address){ + adrs = address; + tpi_send_byte(SSTPRL); + tpi_send_byte(address & 0xff); + tpi_send_byte(SSTPRH); + tpi_send_byte((address>>8) & 0xff); +} + +// writes using SOUT +void writeIO(uint8_t address, uint8_t value){ + // SOUT 0b1aa1aaaa replace a with 6 address bits + tpi_send_byte(0x90 | (address & 0x0F) | ((address & 0x30) << 1)); + tpi_send_byte(value); +} + +// reads using SIN +uint8_t readIO(uint8_t address){ + // SIN 0b0aa1aaaa replace a with 6 address bits + tpi_send_byte(0x10 | (address & 0x0F) | ((address & 0x30) << 1)); + return tpi_receive_byte(); +} + +// writes to CSS +void writeCSS(uint8_t address, uint8_t value){ + tpi_send_byte(0xC0 | address); + tpi_send_byte(value); +} + +// reads from CSS +uint8_t readCSS(uint8_t address){ + tpi_send_byte(0x80 | address); + return tpi_receive_byte(); +} + +// converts two chars to one byte +// c1 is MS, c2 is LS +uint8_t byteval(char c1, char c2){ + uint8_t by; + if(c1 <= '9'){ + by = c1-'0'; + }else{ + by = c1-'A'+10; + } + by = by << 4; + if(c2 <= '9'){ + by += c2-'0'; + }else{ + by += c2-'A'+10; + } + return by; +} + +char Sread(void){ + while(Serial.available()<1){} + return Serial.read(); +} + + +void outHex(unsigned int n, char l){ // call with the number to be printed, and # of nibbles expected. + for(char count = l-1; count > 0;count--){ // quick and dirty to add zeros to the hex value + if(((n >> (count*4)) & 0x0f) == 0) // if MSB is 0 + Serial.print(F("0")); //prepend a 0 + else + break; //exit the for loop + } + Serial.print(n, HEX); +} + +// end of file diff --git a/Attiny_Solar_Energy_Harvest/resources/Atmel-8127-AVR-8-bit-Microcontroller-ATtiny4-ATtiny5-ATtiny9-ATtiny10_Datasheet.pdf b/Attiny_Solar_Energy_Harvest/resources/Atmel-8127-AVR-8-bit-Microcontroller-ATtiny4-ATtiny5-ATtiny9-ATtiny10_Datasheet.pdf new file mode 100644 index 0000000..aa90613 Binary files /dev/null and b/Attiny_Solar_Energy_Harvest/resources/Atmel-8127-AVR-8-bit-Microcontroller-ATtiny4-ATtiny5-ATtiny9-ATtiny10_Datasheet.pdf differ diff --git a/Attiny_Solar_Energy_Harvest/resources/attiny10-resources.html?m=1 b/Attiny_Solar_Energy_Harvest/resources/attiny10-resources.html?m=1 new file mode 100644 index 0000000..9347b00 --- /dev/null +++ b/Attiny_Solar_Energy_Harvest/resources/attiny10-resources.html?m=1 @@ -0,0 +1,1047 @@ + + + + + + + + + + + + + + + + + + +Junk + Arduino =: ATtiny10 resources + + + + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Projects

+
+ + +
+ + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ + + + +

+ATtiny10 resources +

+
+
+
+
+UPDATE: 
+ A huge thanks to Keri DuPrey, Nat Blundell and others who have been continually improving the code. The latest version is here:
+ATtiny4_5_9_10_20_40Programmer.ino
+And a useful GUI by Keri is here:
+GUI: ATTiny4_5_9_10_20_40_Programmer.jar + 
+
+Also, avr-libc 1.7 and newer support ATtiny10! I have not tried it, but I reckon you can now use avr-gcc for the tiny10. However, with only 1kB of program memory, assembly is still useful.
+
+The ATtiny10 is an intriguing little thing. It's the size of a grain of rice and has just 6 little SOT23 pins, but inside lies all the capabilities of an 8-bit AVR microcontroller. Everything from 4 analog input channels to a 16-bit timer with 2 possible pwm outputs to all your basic digital functionality. And at 45 yen a piece, there's little reason not to pick one up to play with. Or two... or ten.
+
+Then once you get home and sit down at your computer, you realize that you are in for a bit more homework than you expected. ICSP doesn't work, common C compilers don't work, hardly anyone online has done DIY stuff with them. 
+
+But hark! Do not forsake hope. I am here to aid you on your journey. First, I will guide you to the references that aided me: (The most useful of these was the last one, but it is in Japanese.)
+ + + + +Hardware
+Now let's think about hardware. If you are willing to purchase an AVR programmer, go ahead. It's an easy solution that will definitely work. In that case, you can skip down to the assembly examples.
+If you would rather do this the hard way(possibly more educational and satisfying), I'll show you how to program the ATtiny10 with only your Arduino, AVR Studio(or anything that will turn your assembly into a hex file) and a few resistors. Also, if you want to make use of all four I/O pins, you will need a 12V power supply for reprogramming.
+
+Here is the basic hardware setup. Thanks to pcm1723 for this drawing and so much more.
+
 *                                                *
+ * Arduino                 ATtiny10               *
+ * ----------+          +----------------         *
+ * (SS#)  10 |--[R]-----| 6 (RESET#/PB3)          *
+ *           |          |                         *     
+ * (MOSI) 11 |--[R]--+--| 1 (TPIDATA/PB0)         *
+ *           |       |  |                         *
+ * (MISO) 12 |--[R]--+  |                         *
+ *           |          |                         *     
+ * (SCK)  13 |--[R]-----| 3 (TPICLK/PB1)          *
+ * ----------+          +----------------         *
+ *                                                *
+ *  -[R]-  =  a few killo-Ohm resistor            *
+ *                                                *
+ * 2011/12/08 by pcm1723                          *
+ Really, some of those resistors may be unnecessary, but they don't hurt. You can see that it is making use of the usual SPI pins, and indeed we are going to make use of the SPI library to handle the communication details. Anyway, I got tired of setting up wires on a breadboard, so I just made this little pcb with 2.2kohm resistors that plugs right into the Arduino.  It also has a connector and jumper for applying 12V to the reset pin. This is only necessary if you disable the reset pin for I/O use.
+
+
 
+Note that pin 1 goes in the top right corner. It faces the same direction as the chip on the arduino. Also note that the ATtiny10 needs to be on an adapter to plug into the DIP socket. I would like the option of using the chips without an adapter, so I want to make something that clamps the chip onto a breakout board without solder. I'll post again if I make something like that.
+
+Software
+Well, that was simple enough. Now for the software. 
+First, you will need to generate a hex file for your program. One simple and guaranteed to work  method is by using AVR Studio, which is free to download from the Atmel website(here). Set your device to ATtiny10, make a new assembly file project thing, write your code, and click "build solution" in the build menu. Your hex file will be buried in a folder in the AVR Studio projects folder. Look for a folder with your project's name and somewhere inside will be a debug folder. hex is inside of that one.
+
+Then we have to get the program onto the chip.
+A big thanks again to pcm1723 for getting me started with the code for the arduino. They posted a simple sketch that uses the TPI interface to read all the memory on the chip and send it via serial to a computer. It was then up to me to extend this code to include all the necessary programming functions. You can find the original code on the fourth link up above. Most of it is included in the code below.
+
+*EDIT* - Thanks to Keri DuPrey for making some nice changes to the code. See the comments below to find a link to the updated code. Changes: supports tiny20 and 40, read,program and verify in one streamlined command, can handle programs larger than 1024 bytes. 
+
+*UPDATE* - Thanks to a commenter for pointing out that the fuse setting and clearing didn't work. With their help I have updated the code and it should work now.
+
+ +Upload this sketch to an arduino. I ran into a very strange problem where it just wouldn't work right if the sketch size was much larger than 7,000 bytes. It would just hang or reset while programming an ATtiny10. I cannot fathom why this is. There should be more than ample memory on the arduino. If anyone has an idea, please let me know(leave comment on home page). Anyway, this version compiled to 6,996 bytes and worked fine. 
+Then power off(unplug) the arduino, connect the ATtiny10 as shown, and power up the arduino again. Open up the serial monitor in the tools menu. Set the serial speed to match the one used by the arduino. The default is 38400. If everything is working so far, you should see the message
+  NVM enabled
+  ATtiny10 connected
+If you don't see this, either you aren't using an ATtiny10 or there could be a hardware problem. After you get this far, you can start using the programming functions. To do this, input the one-character commands described below. Only send one command at a time because some of them require additional input.
+
+Commands:
+
    +
  • D = dump memory. Displays all current memory on the chip
  • +
  • E = erase chip. Erases all program memory
  • +
  • R = read program. Sends the program to the arduino. After sending this command  you have 20 seconds to copy and paste the entire contents of a .hex file into the serial monitor and send. You can do the whole file at once. If it was successful, you should see "program received".
  • +
  • P = write program. After reading the program with the R command, use this to write the program to the ATtiny10.
  • +
  • V = verify. Verifies that the program was written correctly. If not, it will display the errors.
  • +
  • F = finish. Not necessary, but this disables further access until the arduino is reset.
  • +
  • S = set fuse. Follow the displayed instructions to program one of the three fuses.
  • +
  • C = clear fuse. Follow the displayed instructions to UNprogram one of the three fuses.
  • +
+The 'D' command is quite a useful and harmless way to test your programmer and the chip. It simply reads all the memory on the ATtiny10 and displays it in the serial monitor in an easy to read way. You may want to avoid the 'S' and 'C' commands unless you are sure you want to mess with the fuses. There are only three fuses. One sends the clock signal to a pin, one enables the watchdog timer, and one disables the reset pin so you can use it for I/O. If you disable the reset pin, I hope you have a 12V power supply, because you will need it the next time you want to program the chip.
+
+A little caution: if you want to verify after programming, be sure to press shift+v and not ctrl+v as I have done many times. ctrl+v will probably paste your hex file to the monitor again. If you accidentally send it, you will see a lot of strange behavior as the programmer reads 'C', 'D', 'E', 'F' commands along with a bunch of ignored characters. Don't worry, the worst that could happen is that you will erase your chip and disable further programming until you reset the arduino. Just reset and try again.
+
+Examples
+OK, now that you can program the chip the hard part begins. Actually making an interesting program. If you are like me and this is the first time you have used assembly for AVRs, just google "AVR assembly tutorial" and you will find everything you need. It takes a little more work than something like C, so I will give you some simple programs that make use of the various functionality of the chip. They are by no means perfect or interesting, but you can use them as building blocks.
+
    +
  • tinyblink.asm - blinking LED uses delay and digital output
  • +
  • pwm.asm - pulse width modulation uses timer
  • +
  • interrupts.asm - uses three different types of interrupts
  • +
  • analog.asm - uses the analog to digital converter  
  • +
+ Good luck.
+
+
+
+ +
+
+ +

87 comments:

+
+ + +
+
  1. Great, thank you.

    ReplyDelete
  2. Great! I started using Tiny10 in february 2012, and there was almost nothing about it.
    There is information in avr freak too.
    In addition, if someone hates assembler, another option is to write a C code in CodeVision and copy the asm code in AVRstudio. It is a simple way to avoid asm.

    ReplyDelete
  3. About the crash issue. After Taking a quick look at the source code, It looks like the problem may be all the strings that are being printed, each one takes space in ram. I had a similar problem with a project, kept resetting on me, once I moved all the strings to program space I had no more crashes.

    ReplyDelete
  4. Hi I am having problems programming the attiny10 using the arduino and your code. The arduino accepts the code and programs then upon verification it has not been programed, any suggestions would be helpful.

    ReplyDelete
  5. @Mizotor -
    Thanks for trying my code. Here are some ideas:
    If the serial monitor says "NVM enabled" and then "ATtiny10 connected" at the top, then your connections are good and you are properly communicating with the chip. If you don't see these messages, check connections and voltage(needs 5V to program). Once that is working, try the "D" command to dump chip memory to the monitor. If you see something that looks like your program in the program memory space, then you are successfully writing your program. In this case, take a close look at the HEX file. Look at the 8th number of each line. If it is not '0' or '1'(usually near the beginning or end of the file). then it is a special command line, and my code is not set up to do anything with these lines since they are really not necessary for the attiny10. Try deleting the line entirely.

    If all attempts fail, send me the HEX file and I'll try programming one of mine.
    Good luck.

    ReplyDelete
  6. Hello Again and thanks for the prompt response.

    The arduino replies with NVM enabled and ATtiny10 connected, so as you say i believe the chip is connected correctly. I am using your blink program to test the programming capability and the hex is generated by the atmel studio 6 program and is 5 lines long with the 8th character is either 0/1. This hex is accepted and it states program received, then upon 'P' it states Wrote program 62 of 1024 bytes, this is as i expected but with 'D' it returns FF in all the program memory and as i stated before the verify fails as to be expected with all FF returned. I have put the TPI Data on a scope and it appears to be toggling so i don't think it is held at one.

    This is a very confusing problem and i can only think that the reset is not happening so i tried to do a 12v reset but no change.

    Any ideas?

    Regards Mizotor

    ReplyDelete
  7. Interesting project - I wonder can this be used to reprogram ATtiny20 MPU's?

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. @Mizotor -
    Sorry I didn't reply sooner. I'm afraid I don't have any idea what's wrong. You are able to enter programming mode and read the memory, so I don't know why you can't write to memory. I really hesitate to suggest a problem with the chip, but if you have another one handy, try a different chip.

    If you figure out the problem, please tell me/us about it.

    ReplyDelete
  10. @Keri DuPrey -
    Thanks! Putting the strings in program memory is a big improvement.

    This code could actually work with any ATtiny that uses TPI, but the program size would be limited to 1024 bytes unless you made some significant modification to the code.

    The bug concerns me. I have programmed ATtiny10s numerous times without such a problem. I wonder what's happening.

    ReplyDelete
  11. I figured out what the "Bug" is. The Tiny10/20 use the same write opcode of 0x1D, but its for a different word count, Word/Dword. So the chip wont write unless all the words have been sent.

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. @ Keri DuPrey -
    Wow, thanks for that. The programming method is much more streamlined as long as there are no serial buffer issues. I'll update this post to point out your new code.

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. Hi there, thanks for all your efforts put into this! I'm attempting to program at ATtiny10 from an Arduino Uno using the methods described and I'm hoping you could offer some troubleshooting tips.

    I have everything wired up and I successfully get the "NVM enabled" and "ATtiny10 connected" when opening the serial monitor. From there, I can send D and it will dump the data from the chip, but will follow the dump with a single "Received unknown command". If I try R, it simply returns with "Received unknown command" twice.

    Any idea what the issue might be? I'm not quite sure where to start my troubleshooting. Thanks.

    ReplyDelete
  16. @Chris -
    Thanks. Are you using my code or the updated version by Keri DuPrey(linked in a comment above)? Also, tell me about your software setup. The "Received unknown command" message appears when any character that is not a command is sent, except when reading in hex data. This includes a newline character. I'm using the current Arduino serial monitor in Windows and I've never seen this problem. I'm wondering if you are automatically sending a newline character. But even then the 'R' command should be accepted.
    Unless you are using Keri DuPrey's code which has slightly different commands. Those are documented at the top of that code.

    ReplyDelete
  17. I could have sworn I read the comments at the top at least a couple times! Turns out that's most of the problem: I am using the updated code and should be using P to program. Also, the automatic newline sending is indeed why I was getting the extra error after normal accepted commands.

    Now I'm successfully able to program it! One last issue I'm running into though: I have to copy/paste the hex file line by line as I think copy / pasting the entire thing incorrectly converts the line endings and only uploads part of the program before outputting a bunch of unknown command errors.

    I am using a mac running 10.7.5, so I'm not sure you would have any suggestions for this sort of issue but I thought couldn't hurt to ask. Copy/paste in general does not seem to work well in the Arduino IDE. What character should each line be separated by?

    ReplyDelete
  18. @Chris -
    Good, I'm glad you got it working. I don't really know much about a mac, but the actual line ending character doesn't matter. Actually, you don't even need one. The line length info is included in the hex code, so the arduino code does not check for line endings and if there is an extra character that is not ':' it is just ignored. However, if there is more than one extra character, it will cause an error. So maybe you are sending more than one character after the line? Maybe a tab or space character?

    ReplyDelete
  19. @Chris -
    The problem for programming the entire flash at one time may be from a serial buffer overrun. Try dropping the speed to 9600, or less, I don't have any 10's to test but they might write/verify slower.

    ReplyDelete
  20. I have dropped the speed down to 9600.

    ReplyDelete
  21. That was it! It gives me one extra "Received unknown command" error after successful programming, but successfully programs none the less.

    Looks like it's time for me to delve into some assembly, thanks for the help getting this working.

    ReplyDelete
  22. Thanks for the programmer code guys, awesome work. I haven't used it yet, but about to as I am making my first ATtiny10 board. I just have a question about the Hex code for the Attiny10, can I use the arduino IDE itself to write a code, compile that code and then use generated HEX to program ATtint10? How about adding information about attiny10 to the arduino board.txt file?

    ReplyDelete
  23. What i mean is somehting like this http://elabz.com/arduino-shrunk-how-to-use-attiny13-with-arduino-ide/

    but for ATtiny10/9/5/4 instead of ATtiny13

    ReplyDelete
  24. @Fahad -
    Unfortunately you cannot use the Arduino IDE because the C compiler, avr-gcc, does not support the attiny4/5/8/10 yet. I think the reason is that there are only 16 useable registers while the rest of the attiny series has 32. But with only 1kB or less of program memory, you will probably want to do the coding in assembly anyway.

    On the other hand, if you write only assembly code in the arduino IDE in proper C assembly format you may be able to do it. I think it would be simpler to just use AVRStudio which is free on the Atmel website.

    ReplyDelete
  25. @ME
    That is actually what I am trying to avoid, learning AVR C or Assembly.

    But you are right with such limited device I think assembly is the way to go. Is there any website that you recommend to start learning about programming those tiny mCUs?

    I also found you mosquito code which will help me a lot since I am planing to use an IR receiver as part of my design.
    So thank you twice ;)

    ReplyDelete
  26. @Fahad -
    Get ready for quite a learning experience. Don't rely on your knowledge of other languages because you will need very different techniques with assembly. But don't be discouraged.
    First, download the AVR instruction set here. It will be your manual. Also, this guide has some useful info and examples. Then download my small example files on this page and go over them carefully till you understand what's happening.

    As for the IR stuff, my code is designed to record a signal of unknown protocol and length. If you are using a protocol that you know, you can make it vastly, vaaastly simpler. I bet you could do it in 20 lines rather than several hundred. If you have any questions, let me know.

    ReplyDelete
  27. Thanks a lot.
    I have two questions:
    1- AVR-GCC that comes with AVR Studio 6 has support for attiny10, but the one with arduino doesn't! Don't they both belong to the same project? and both should be GPL and open source? or simply the arduino people are not interested in including the code since they don't use that type mcu?

    2- My project will read IR codes sent from any type of IR remote control (so what you did exactly matches what I need) and will compare that code against a code that is stored in the attiny10. I am interested in matching one code only however, I don't want that code to be hard-coded. I rather want the user to be able to reprogram that code to match any remote control button they want. But the attiny10 doesn't have EEPROM, so can we store data into the flash from the running code itself? or do I need to use another chip like the attiny13a.

    ReplyDelete
  28. @Fahad -
    You're right! avr-libc 1.7 and newer support ATtiny4/5/9/10. Great, this changes everything. Arduino might not come with the latest version of avr-libc(the libraries used by avr-gcc) yet, but I think you could just replace the appropriate files to use the newest version with arduino.

    As for the memory question, I'm sorry to say that there is no way to write to flash memory from running code. You only have access to SRAM and the registers. If you really need this feature, ATtiny13 and others will be a better choice.

    ReplyDelete
  29. Hi,

    first of all: this is a very useful blog, and gives a "nearly" ;-) perfect solution.
    Thanks a lot.

    But did you already set a fuse on a tiny10? I want to see the System clock on PB2, therefore i issued command 'S' followed by 'c'. But nothing changed. The configuration word still says 0xFF 0xFF.
    I think the code for Setting/Clearing the fuses is wrong, as it only writes the LSB.
    The mcu waits for the MSB before it really writes the fuses.

    Greetings

    Mic

    ReplyDelete
  30. @Anonymous -
    You're right! Thanks for telling me. I never tried changing fuses, so I didn't notice, but I actually left out a few important steps including writing the MSB.
    I've updated the code and it should work. I don't have time to test it right now, but if it still doesn't work, let me know.

    Also, this update is only in the file provided on this blog. It is not included in Keri DuPrey's newer code yet.

    ReplyDelete
  31. Hi, thanks for your quick reply, i tried your code fix, and Setting the fuse works now fine.
    Clearing does not. I read the Atmel Manual, and Clearing fuses Needs a SECTION_ERASE instead of WORD_WRITE in NVMCMD Register.

    I changed the code in setConfig
    to:
    setPointer(0x3F40);
    writeIO(NVMCMD, (val ? NVM_WORD_WRITE : NVM_SECTION_ERASE) );

    which works.

    Greetings,
    Mic

    ReplyDelete
  32. @Anonymous -
    Thanks again. I put your fix into the code. I hope there are no more surprises like that. More importantly I hope it hasn't caused too many headaches for people using it.

    ReplyDelete
  33. I've made the changes to the code as well.

    ReplyDelete
  34. This patch for Keri DuPrey's code re-enables the ATtiny after each command. This allows faster iterations of development as you don't need to re-wire the RST line to test.

    Index: ATtiny45910Programmer.ino
    ===================================================================
    --- ATtiny45910Programmer.ino (revision 2)
    +++ ATtiny45910Programmer.ino (working copy)
    @@ -137,6 +137,16 @@
    SPI.setDataMode(SPI_MODE0);
    SPI.setClockDivider(SPI_CLOCK_DIV32);

    + start_tpi();
    +
    + // initialize memory pointer register
    + setPointer(0x0000);
    +
    + timeout = 20000;
    + idChecked = false;
    +} // end setup()
    +
    +void start_tpi() {
    // enter TPI programming mode
    digitalWrite(SS, LOW); // assert RESET on tiny
    delay(1); // t_RST min = 400 ns @ Vcc = 5 V
    @@ -153,13 +163,7 @@
    // wait
    }
    Serial.println(F("NVM enabled"));
    -
    - // initialize memory pointer register
    - setPointer(0x0000);
    -
    - timeout = 20000;
    - idChecked = false;
    -} // end setup()
    +}

    void loop(){
    if(!idChecked){
    @@ -171,6 +175,8 @@
    while(Serial.available() < 1){
    // wait
    }
    + start_tpi();
    +
    // the first byte is a command
    //** 'P' = program the ATtiny using the read program
    //** 'D' = dump memory to serial monitor
    @@ -209,6 +215,8 @@
    default:
    Serial.println(F("Received unknown command"));
    }
    +
    + finish();
    }
    void ERROR_pgmSize(void)
    {
    @@ -552,7 +560,7 @@
    writeCSS(0x00, 0x00);
    SPI.transfer(0xff);
    SPI.transfer(0xff);
    - // digitalWrite(SS, HIGH); // release RESET
    + digitalWrite(SS, HIGH); // release RESET
    delay(1); // t_RST min = 400 ns @ Vcc = 5 V
    }

    ReplyDelete
  35. what arduino did you used?

    ReplyDelete
  36. can i use this software with other programmer wich is capable if ISP? I mean :can I use something different from Arduino ? Something similar into Arduino?

    ReplyDelete
  37. @Anonymous -
    Of course you can use something instead of Arduino. The arduino is essentially just using SPI to act as a TPI programer. Look at the data sheet to see the differences between SPI and TPI, but they are pretty much the same.
    Of course the software I have written is specific to arduino, but I imagine it could easily be ported to whatever SPI capable programmer you are using.

    ReplyDelete
  38. You are awesome!

    It took a bit of fixing to get the tinyblink program to work, but the attiny10programmer.ino worked flawlessly.

    I used tavrasm because it was easier for my setup, and I had to change the call instructions to rcall.

    I still have to make sure I can re-program after disabling RESET, but it's over there blinking away.

    Thank you for your work, and for sharing it with people like me.

    ReplyDelete
  39. @Jimmus -
    I'm glad I could help.
    I haven't tried disabling the reset pin, so good luck.
    Have fun!

    ReplyDelete
  40. I had an erratic issue with the nibbles being swapped when programming, and made a change that seemed to clear up the problem. I also added Nat Blundell's patch to the code.


    ATtiny4_5_9_10_20_40Programmer.ino

    ReplyDelete
  41. @Keri DuPrey-
    Thank for doing that and thanks for keeping this code up to date. I haven't run into that problem, but I'm glad it was easy to fix.
    Also, thanks to Nat Blundell. I think I forgot to thank you for your patch.

    ReplyDelete
  42. Keri,
    sketch : ATtiny4_5_9_10_20_40Programmer.ino

    posted:
    March 17, 2014 at 5:45 AM

    Line 597 is missing an 'else'

    .Causes serial monitor to report TINY and Unknown chip.

    ReplyDelete
  43. I've added the missing else statement and a quick reset option. Also, Added High Voltage Programming, on pin 9, to the code, along with select-able High/low enable, depending on the users design for providing 12v.

    ReplyDelete
  44. I had to mod the quickReset function to get one of my tiny4's to reset.
    I added a SS,HIGH immediately before the existing SS,LOW.
    Another tiny4 reset without it.
    The offender is at the end of 10 inches of ribbon cable -- in case that helps.

    void quickReset()
    {
    digitalWrite(SS,HIGH); //pull /RST high for an instant
    digitalWrite(SS,LOW);
    delay(10);
    digitalWrite(SS,HIGH);
    }

    Before adding the SS,HIGH line, I could short the /RST pin to GND, while the SS output was HIGH and the tiny would reset. I have 1K5 resistors as per the diagram in sketch, so the output was safe.

    ReplyDelete
  45. @Anonymous -
    That's really strange. I'm not sure what flicking the reset line high like that would change. But if it works, great. Thanks for the idea.

    ReplyDelete
  46. I've added the quick send to high for the reset. Thanks for the tip!

    ReplyDelete
  47. So I am back doing a project with my AtTiny10, and I started with a working program, the TinyBlink, of course. I found 2 minor errors, neither of which affects the execution of the small program, but which might affect things if the program is expanded.

    ; not really needed, but keep r16-r18
    push r16
    push r17
    push r18
    ...
    pop r17
    pop r16
    pop r18
    ret

    Yeah, I don't think that's going to work.

    ; variables
    .EQU delayMult1 = 0xff ; the delay is delay3*delaymult2*delaymult1
    .EQU delayMult2 = 0xff
    .EQU delayMult3 = 0x0f

    I looked at the code that uses these variables in the delay, and I don't think that's the right formula. I think it is:

    delayMult3 * 65536 + delayMult2 * 256 + delayMult1

    Which is better anyway because it gives us highly accurate control of this delay loop.

    I considered using the watchdog timer for my timing needs, but with delays accurate to within 5 clock cycles, and programmed this easily, who needs it?

    ReplyDelete
  48. @Jimmus -
    Thank you for checking that. That was my first attempt at assembly code for the ATtiny10. Looking back at it, it is awful. You are right about the "pop" order not working. The math for the delay is also wrong. It was just a poorly written piece of code that happens to work. I should probably update all of those files.

    ReplyDelete
  49. Well, while I was messing with it, I found out some other things. Like how the registers and pins are initially set up. For example, the stack pointer is already set to EndOfRam for us, so we don't really need that code. And all the pins are set to input mode, but if we set one to output mode, it's already off. Not that we care, since we're blinking on and off anyway, but the point is we can remove that code as well. And it works just as well at the default 1 MHz speed if we adjust the timer multipliers, so we could remove that code as well. Which got me to thinking, how small could we really make this blink program? Try this out:

    ;
    ; tinyblink
    ; Blinks an LED on pin 4 (PB2)
    ;
    ; Version 1.05
    ; Taken from http://junkplusarduino.blogspot.jp/p/attiny10-resources.html
    ; and modified by Jimmus

    ; .DEVICE ATtiny10

    .EQU PORTB = 2
    .EQU DDRB = 1
    .EQU PINB = 0

    main:
    sbi DDRB, 2 ; Set LED pin as output

    loop:
    sbi PINB, 2 ; Toggle output

    delayLoop:
    subi r16, 1
    sbci r17, 0
    brne delayLoop
    rjmp loop

    It does blink a little bit faster--about twice a second, and the interval is not configurable. But 6 instructions is pretty small, I think.

    ReplyDelete
  50. Hello,

    Thank you so much for this blog and the source. I've learned a great deal. I had unfortunately quite a few problems getting the programmer to upload consistently due to serial overruns.

    I completely rewrote the source over the weekend and it is working better for me now. I've uploaded my project to github.

    https://github.com/bdpdx/ATtiny10Programmer

    ReplyDelete
  51. @par -
    I'm glad this could be of help. Of course the most educational way is to write your own programmer. Thanks for sharing yours.

    ReplyDelete
  52. Thanks for the web site!
    I made the following changes to the programmer so I didn't have to unplug, remove wires, and plug back in. The finish command just puts everything in high impedance mode and pulls the reset high. Then it goes into an infinite loop until the Arduino reset button is pressed. It isn't too sophisticated, but it seems to work.

    void finish(){
    writeCSS(0x00, 0x00);
    SPI.transfer(0xff);
    SPI.transfer(0xff);

    pinMode(10, OUTPUT);
    pinMode(11, INPUT);
    pinMode(12, INPUT);
    pinMode(13, INPUT);

    digitalWrite(10, HIGH); // release RESET

    delay(1); // t_RST min = 400 ns @ Vcc = 5 V
    while(1) {} // infinite loop until reset
    }

    ReplyDelete
  53. Sorry, I just noticed that Keri DuPrey's version did the same thing ... never mind.

    ReplyDelete
  54. @Anonymous -
    Thanks for contributing. Lots of people have made improvements or different versions. Writing your own is a great way to learn, so keep it up.

    ReplyDelete
  55. A blink program that uses the timer function. It is a bit larger, but the blink rate is fairly accurate.

    http://www.calebengineering.com/attiny10.html

    ReplyDelete
  56. Hi there,

    The procedure you described works for the ATTiny4 (you can take the "possibly" off your header ;) ).

    This is phenomenal, thank you so much for sharing!!

    Léo.

    ReplyDelete
  57. Actually...

    I did the process once and it worked perfectly.

    Now I'm trying to upload some new code, and it's behaving unexpectedly :

    - When a one-letter command is sent, the chip won't answer unless the PB3 (reset, connected to Arduino digital #10) is disconnected from the Arduino. So it seems to read input from the serial monitor but not to be able to send info back to it unless PB3 is unplugged.
    - With PB3 unplugged, E command returns "chip erased" as expected but LED keeps blinking. (LED stops blinking when PB3 is replugged to Arduino #10)
    - Trying then to upload code with PB3 unplugged, works until "V" command that returns:
    "
    program error:
    byte 00AB expected 95 read 00
    "

    for all bytes (all zeros because I have reset in the meantime with E command)

    So basically having PB3 connected seems necessary to be able to upload new code but makes communication impossible... ?

    Thanks for your help
    Léo.

    ReplyDelete
  58. @Leo

    Its been a few years since I looked at the original "ATtiny10Programmer" code, but it sounds like it holds the reset(PB3) low. you may want to try the "ATtiny4_5_9_10_20_40Programmer" releases reset when programming is finished.

    ReplyDelete
  59. Just finished a project, and realized that a GUI interface was needed, So I wrote a generic one, in java, for the ATTiny4_5_9_10_20_40_Programmer.ino

    GUI: ATTiny4_5_9_10_20_40_Programmer.jar

    I've got plans on combining the programmer and a simple digital I/O firmata together to help with testing tiny programs. I may need some encouragement to get going on that as I have no other tiny projects at the moment.

    ReplyDelete
  60. Keri,

    This is great! My ongoing project could totally use all these improvements!

    I just need to make sure it's not making my chips un-overwriteable.

    I'll try that this weekend when I have a moment! Thank you so much for following up !!

    Léo.

    ReplyDelete
  61. @Keri DuPrey -
    Wow. Thank you for continuing to develop this. You are doing a great service to all ATtiny fans. Sadly my life has not allowed me to even pick one up for the last year, but I'm sure many people appreciate your effort.

    ReplyDelete
  62. Hi Keri

    I fail to open the .jar file. It shuts itself down straight away. I'm not sure if it helps that I send you the OS X Console messages?

    Thanks for all your help
    L.

    ReplyDelete
  63. Hi
    Quick update on the initial problem I had with not being able to upload anything else after the initial upload: it was indeed the RESET pin that was not released when finished.

    In void finished(), uncommenting "digitalWrite(SS,HIGH);" does the trick!

    Thanks again
    Léo.

    ReplyDelete
  64. @Leo,
    It may help. You can send it to my email ksdsksd@gmail.com

    ReplyDelete
  65. Great reading. smallest Atmel chip I used was the attiny13, but sizewise nothing beats the attiny10 I guess. May give that a try. I think my last endavours in assembler ate at least 20 years ago for the 8052/51/32/31 Intel chips, but I might be fun to pick it up again for the attiny10.
    Only problem.. not sure if i will be able to solder the little buggers into anything, eyesight isnt what it used to be anymore and if i have to put them on a breakoutboard for a DIL socket I might as well stick to bigger chips. Well, I may give it a try. did you ever find a solution to just clamp the Attiny10 to a programmong board? Maybe just some copperpads and a clothespin would work miracles :-)

    ReplyDelete
  66. Well thank you very much. I followed the instructions dilligently and it "just worked". Can't ask for more than that!

    ReplyDelete
  67. Your use of SPI for the serial connection with the Tiny10 is brilliant! I have written a avr910 compatible TPI programmer for the ATmega328p so it interfaces directly with avrdude. It worked but I was bit banging the TPI ports and couldn't get the performance I wanted. Now I have adopted your SPI routines and my programmer is smoking fast running on an Arduino UNO! Thanks very much.

    ReplyDelete
  68. Many thanks for providing these resources! I'm a complete newcomer to programming MCUs, so some of my problems may be related to that, however I'm having trouble getting my Arduino Uno (with the sketch you provided at the top of the page successfully uploaded) to recognize my ATTINY20. The serial monitor prints out "NVM enabled, unknown chip connected" and when I dump the memory the Device ID is all zeros. A friend successfully got your code working with an earlier version of Arduino IDE, but not with the version current to June 2016. Any idea what might be going on and why the most recent version(s) of the IDE might be causing errors? Any help would be greatly appreciated.

    ReplyDelete
  69. @Julian Kapoor -
    I've never tried an ATtiny20, but supposedly it should work using Keri Duprey's code. Which Arduino code are you using? You should be using the one at the top of the page, ATtiny4_5_9_10_20_40Programmer.ino instead of the older file further down. I don't know what has changed with the new version of Arduino, but if they made changes to the SPI library it might mess things up. Try an older version of Arduino. If that doesn't work, I'm not sure what's going on. If I have time later I'll try an ATtiny10 with the new Arduino.

    ReplyDelete
  70. Hold the press! I was working with a couple of chips that I must have fried somehow. The programmer sketch works great on the ATtiny20 using Arduino IDE 1.6.8 now. Thanks again to you and everyone else who has contributed to this project!

    ReplyDelete
  71. Programming is very interesting and creative thing if you do it with love. Your blog code helps a lot to beginners to learn programming from basic to advance level. I really love this blog because I learn a lot from here and this process is still continuing.
    Love from Pro Programmer

    ReplyDelete
  72. This blog awesome and i learn a lot about programming from here.The best thing about this blog is that you doing from beginning to experts level.

    Love from Pprogramming

    ReplyDelete
  73. I notice a bug(maybe)

    Flash Words 0x1D CODE_WRITE of ATtiny40 is Qword.
    So, it must be "#define Tiny40 4" I think.

    #define Tiny4_5 10
    #define Tiny9 1
    #define Tiny10 1
    #define Tiny20 2
    //#define Tiny40 3 <- bug
    #define Tiny40 4

    >> if ( currentByte == 2 * words ) { // is the word/Dword/Qword here?

    >> Serial.println(F("Current memory state:"));
    >> if(type != Tiny4_5)
    >> len = 0x400 * type; //the memory length for a 10/20/40 is 1024/2048/4096

    ReplyDelete
  74. This comment has been removed by the author.

    ReplyDelete
  75. I added the standalone programming mode like trinketloader in order to https://codebender.cc/sketch:72538
    Paste the hex code to image.h and you can program without paste the code into serial monitor.
    https://www.dropbox.com/s/dvbn3kv3qbci4ah/ATtiny4_5_9_10_20_40Programmer.zip?dl=0

    ReplyDelete
  76. Hi Keri DuPrey. I am respect on your work.
    How do you think about "#define Tiny40 3 (or 4)" ?

    ReplyDelete
  77. @InoueTaichi
    You are correct, it should be 4. Thanks for finding that, I've applied the change. It's been quite some time since I've done a tiny 20 or 10 project, haven't done a 40 yet.. And even longer since I've actually looked at the programming code.

    ReplyDelete
  78. Hello, great stuff here,

    I did a read out of ATTiny10 i had here, for extracking the program, and i get the data, however, program 4000 and up is just pure 0's, so there is no program on?

    SRAM has code, can i clone this to a hex file? so i can make a copy of the chip?

    The code i get is here:
    http://www.elteq.dk/attiny10.txt

    If anyone can do a hex file for me or tell me how to do so i get a clone of this, would be great :)

    ReplyDelete
  79. @Bo

    Sorry Bo, haven't been on for a while. The file you provided is no longer there. But from what you've described, there is no way to make a copy. The program needs to be there.

    ReplyDelete
  80. Hi!
    Thank you very much for your post, it’s been really helpful and it's working pretty well! I’d like to manipulate lock bits to prevent memory for being read. I’ve been trying to modify the code with no succed :( Please can you help me?
    Thanks!

    ReplyDelete
  81. This comment has been removed by the author.

    ReplyDelete
  82. @Manuel

    I've added a Lock function to the code and republished... Tested on a tiny10.

    ReplyDelete
  83. @Keri Thanks! I'll check it ASAP

    ReplyDelete
  84. Thank you very much for your post, it’s really helpful and successfuly working well.......
    actually we are working on ATTiny20..... and this post also useful for ATTiny20 also......
    $
    $
    $
    Thank you very much........

    ReplyDelete
  85. Please guide me that my blink eg. on attiny10 doesn't work, even though the Arduino detect it as "NVM enabled, ATtiny10 connected" on serial monitor. But on upload it say "avrboy" is not meant for your version of windows. My OS is Window 10 pro.

    ReplyDelete
  86. This comment has been removed by the author.

    ReplyDelete
+
+
+
+ +

+

+ + + + +
+

+ +
+
+
+
+
+
+ + +
+
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/Attiny_Solar_Energy_Harvest/resources/tinyblink.asm b/Attiny_Solar_Energy_Harvest/resources/tinyblink.asm new file mode 100644 index 0000000..85e05dd --- /dev/null +++ b/Attiny_Solar_Energy_Harvest/resources/tinyblink.asm @@ -0,0 +1,73 @@ +; +; tinyblink +; Blinks an LED on pin 4 (PB2) +; + +.DEVICE ATtiny10 + +; variables +.EQU delayMult1 = 0xff ; the delay is delay3*delaymult2*delaymult1 +.EQU delayMult2 = 0xff +.EQU delayMult3 = 0x0f + +.CSEG ; code section +.ORG $0000 ; the starting address +main: + ; set up the stack + ldi r16, high(RAMEND) + out SPH, r16 + ldi r16, low(RAMEND) + out SPL, r16 + + ; set clock divider + ldi r16, 0x00 ; clock divided by 1 + ldi r17, 0xD8 ; the key for CCP + out CCP, r17 ; Configuration Change Protection, allows protected changes + out CLKPSR, r16 ; sets the clock divider + + ; initialize port + ldi r16, 1<