I'm having a blast taking the Contextual Electronics course http://contextualelectronics.com/ (http://contextualelectronics.com/). We're using KiCad to design and build boards. I wanted to test my knowledge. I'm designing a board with an ATTINY85 and RFM69W.
I have attached a PNG of the schematic. Does it look ok? Stuff I should do differently?
Then I'm wondering:
- I have a LED on the same pin as MOSI. The thought process I had was: 1) light the LED every time data comes in from the RFM69 to the ATTINY85 2) saves on pins. Does this make sense?
- I have 3 sensors I'd like to use. Two use serial port. One uses Digital write. Since they are read at different times, I assume I can use pin 2 (PB3) and pin 3 (PB4) for all sensors (switching in software)? Is that possible? If so, is there a better way?
Thank you very much.
Is the Attiny85 design part of the course? Or is it just something you're trying to build yourself?
The chip is so limited I'm not even sure it's worth bothering. Some people seem to think that by 30 cents difference will save them a lot of money in the long run by using the tiny. I would not use this chip for anything other than blinking leds and turning something on/off. I mean it's 8K of flash, 0.5K of RAM/EEPROM. Really .. do yourself a favor and use an atmega328p. I'm ready to bet the library will not work at all on the attiny, or you will have a nightmare trying to port (perhaps you might get it working but by slimming down the lib considerably). Not to speak about bootloading...
Other than that don't let this discourage you, I think you're doing good! But I would strongly recommend going with a atmega328p since everything will just work. You could perhaps replicate a Moteino in Kicad :P
Incredibly helpful. Thank you Felix. It is just something I am trying to build a week into the course. Your comments make perfect sense. I won't be pushing this square peg into a round hole that requires a bit more beef and flexibility on i/o (ports). You definitely never discourage - rather raise enthusiasm!
A n00b question on your Moteino schematic regarding the voltage regulator.
I don't understand the choice of capacitor sizes in the schematic.
If I read the schematic correctly for the voltage regulator, the first capacitor (1uF) is hooked up after the voltage source. According to Table 1 in this TI document http://www.ti.com/lit/an/scaa048/scaa048.pdf (http://www.ti.com/lit/an/scaa048/scaa048.pdf) , the size of the capacitor has mostly to do with frequency. So if I have a wall wart I wish to use that has a frequency of 50/60Hz, could this capacitor be smaller (say the 47uF as the smallest on table 1 (versus the 1uF you use)? I "sort of" understand the need for the other two capacitors. Why did you choose 10 uF and.1 f? And the ordering of these two doesn't matter - is that correct (since there is nothing hooked between the two)?
Thanks very much!
The caps were chosen to be close to what the datasheet suggests. See: http://ww1.microchip.com/downloads/en/DeviceDoc/22049f.pdf
I chose 10uF on the output to have a little more buffer than 1uF. There is also a 0.1uF to filter out high frequency noise that may be inherited through the regulator.
You could use any other cap but have to mind it might take a little while to charge a big cap. In general you should choose a large cap if there are parts in your circuit which require short bursts (order of ms) of very large currents that cannot be supplied by the regulator. The RFM69HW transceiver is a good example here sucking up to 130mA in short bursts when transmitting according to the DS, even though it's still well within the 250mA spec of the regulator, it's good to have a little 10uF buffer in the circuit after the regulator.
Sketchy,
A common name for capacitors used in this manner is decoupling capacitors or bypass capacitors. Google these terms and you will find a shocking amount of information. One that I found that seemed to be a pretty good starting point: http://www.intersil.com/content/dam/Intersil/documents/an13/an1325.pdf (http://www.intersil.com/content/dam/Intersil/documents/an13/an1325.pdf) Bypass caps are a topic worthy of a full course themselves; the good news is that for relatively low speed digital circuits like Moteino, back of the envelope calculations like Felix describes generally work well.
One other important aspect: The physical location of these bypass capacitors is important. In general, you want the decoupling caps located near the power pins of the devices that you are trying to provide clean(er) power to.
I've seen it done (http://harizanov.com/2012/06/experimenting-with-attiny85-rfm12b/)with modified version of RFM12b library, one that doesn't use IRQ (since ATtiny85 doesn't have enough pins).
I think it's a great idea to use Attiny based sensors, due to their low power. 328 is overkill in most cases :) I'm planning to build ATtiny84 based (it has 14 pins, thus more useful than 85) RF transmitter (remote) that will operate on coin cell battery for a year or so... I know moteino works on coin cell too, but not very reliably unless you cut down oscillator to slower speed (I think 8Mhz is minimum).
Anyway I'm curious if Felix's library will work with ATtiny84 (gotta try both RFM12b and RFM69), I'll post my results once I tested it.
Hi,
Don't know if this is of interest but a while ago I built a clone of Jean Claude Wippler's ATTINY84 based JNu. Worked really well except for limited range due to RFM12B module. When RF69 modules and Felix's RF69 lib came along, one of the first things I tried was replacing the RFM12B module with a RFM69HW module and rewriting the code using Felix's RF69 library... no great surprise, the code refused to compile. Would certainly be interested to hear how you go!
cheers,
Guys ... as much as I appreciate your drive and effort to make this work I think it's not very much worth the time to invest in the tiny chips. As soon as you will get them to work, it at all, you will realize how limited those chips are. I let myself into a debate with another guy who thought the tiny chips are the holy grail of cheap and low power, and I won't repeat that here. Quite frankly I would not put any time into it just knowing there is 512bytes of RAM to work with. I will take the subway in place of the donkey :), no offense . I don't mind a buck more, I like the ride much better.
If you were a billion dollar company that needs to save a few cents per end unit and that adds up to millions in production savings, then it makes sense to hire someone to spend their time coding to make everything fit into the tiny memory and work with the limitations. For the hobbyist who needs a few dozen nodes, the effort to cost ratio is so low that it makes no sense, at least in my mind. I would rather spend the extra bucks and the saved time at the beach :)
Come to New York City and ride subway during peak hours, you'd reconsider donkey :)
I still think Attiny has it's place in simple sensor or remote control application. 512B should be sufficient for simple tasks. As for price difference, it's substantial. 50 Atmega328p chips would cost you $120.50, while 50 ATTiny84As is only $50...
I was just there for a few days last month ;)
It wasn't too bad at all.
I agree about the simple tasks. They are made for a purpose and they serve that purpose well, when they FIT the purpose. But when people start to lobby that they are the best thing for all around arduino type projects and they can do ethernet with them and all kinds of twisty jazz that takes incredible amount of effort to work around the lack of features and limitations ... I'm wondering what are they really gaining by saving 70cents - from your quote :)
Again, if that saves you 1 million dollars in the end product, which allows you to pay someone 100K in consulting fees to make it work on the tiny .. then you are 900k in final savings, makes sense. If you are saving $100 and investing more than 2 hours to make something work .. it's not worth your time. Unless you think your time is worthless ;)
But it's worse than that, if you buy even 10 chips, you're saving .. what - $7, maybe $10? Remember you're still paying for shipping which is likely more than that. The math doesn't add up folks.
My 2p:
I like, for elegant reasons, the idea of working on very small chips, with very lean code.
That aside, using something smaller than the 328P is just insane outside of 99.99% of applications where the advantages outweigh the limitations.
I think about it this way: any deployed application will cost enough per unit to render the price difference totally meaningless.
On top of that, consider your time. What is it worth to you? If you spend two hours adapting code to make your stuff squeeze into an ATTiny, that's at least $100. Those figures are very lean, but still that would be the difference in price for 100 chips, and what you get in return is a very limited chip with no room for expansion or flexibility.
I just can't see that ever making sense to me. Unless it's just to say that it can be done. In that case, carry on.
C
Check this out: http://hackaday.com/2014/08/29/bit-banging-ethernet-on-an-attiny85/
Yes folks, breaking news! You CAN bitbang ethernet on an attiny!!! A bit more effort and you can fly to Mars on an attiny!
No really, you can probably do anything on an attiny. It CAN be done, if you try really hard and the bonus is you will most certainly make it the front page of hackaday, can't beat that huh...
Perfect.
I feel the same way about people bitbanging or using kernel drivers for 1wire on the Pi. Buy an $0.80 1Wire master for I2C and enjoy error-free, owfs-supported beauty.
I understand hacking for hacking sake, but the way we move forward is by not reinventing the wheel unless there is a reason to do so.
C
Quote from: Felix on October 25, 2014, 10:52:15 AM
Check this out: http://hackaday.com/2014/08/29/bit-banging-ethernet-on-an-attiny85/
Yes folks, breaking news! You CAN bitbang ethernet on an attiny!!! A bit more effort and you can fly to Mars on an attiny!
Interesting comment.
Fly to Mars? Don't know. Fly to the moon? Well Almost. Actually the spec of the Apollo Guidance Computer more closely resembles the 328 than that of the tiny.
Clock 2MHz
RAM 4Kb
ROM 72Kb
Weight 32Kg
Power 55w
Source
http://en.wikipedia.org/wiki/Apollo_Guidance_Computer
Interesting comment.
Fly to Mars? Don't know. Fly to the moon? Well Almost. Actually the spec of the Apollo Guidance Computer more closely resembles the 328 than that of the tiny.
Clock 2MHz
RAM 4Kb
ROM 72Kb
Weight 32Kg
Power 55w
Source
http://en.wikipedia.org/wiki/Apollo_Guidance_Computer
[/quote]
Well it was meant more rhetorical, I would not take it that far but if we want to spin this around, you could cluster them and make a multicore attiny CPU that could do the job. I'm sure for every idea there is someone out there that can find a way to do it. I don't have that kind of patience :)
I think we beat this dead horse too much.