openenergymonitor / EmonLib

Electricity monitoring library - install in Arduino IDE's libraries folder then restart the IDE
openenergymonitor.org
GNU Affero General Public License v3.0
589 stars 419 forks source link

attiny85 and serialprint() #2

Open hamspot opened 11 years ago

hamspot commented 11 years ago

attiny85 has no hardware uart. EnergyMonitor::serialprint() fails to build due to dependency on Serial library.

glynhudson commented 9 years ago

Do you have an example / fix for this issue? Sorry it's take so long to get round to trying to fix..

JadinAndrews commented 9 years ago

This would probably need software serial, right? I'll give it a try when my atiny85 arrives. not sure there will be enough ram though.

juanpintom commented 9 years ago

Hi!, this is an old and unsolved issue, I want to share this example working on an ATTINY85, It sends the readings to an ESP8266 modules: https://github.com/juanpintom/Souliss_ESP_Examples/blob/master/E06_ATTINY_EMONLIB

Hope this help you.

Regards.

JadinAndrews commented 9 years ago

That's good to know that it works, just a question, what code are you running on the esp8266? If I understand correctly, you have the esp8266 configured as a master with the ATTINY85 as a slave? I was wondering if it wouldn't be possible to to use the ADC on the esp8266 instead of the ATTINY85? That would require a port of the emonlib to Lua. Only downside is that I think http requests would block ADC readings.

juanpintom commented 9 years ago

Hi Jadin, Im running Souliss on ESP, yes, for now Im doing as you say. Attiny get's the data and send the value to the ESP, this shows W and A on an Android App and sends data to Emoncms. You can look at the wiki of my examples to get more info. Am doing this way for now because I can't get emonlib working on ESP module, yet.

Yes again, take care, the range of ADC pin on ESP is 0-1v, and I need some help to port emonlib. On Souliss we work over Arduino ESP IDE. and here is a post: http://www.esp8266.com/viewtopic.php?f=32&t=3112&hilit=EMONLIB

We use this way to upload to the ESP: https://github.com/esp8266/Arduino

Souliss is an OpenSource Framework to make working a Domotic home based on Arduino and ESP modules. You can take a look about here: https://github.com/souliss/souliss

Regards

JadinAndrews commented 9 years ago

Great!

Thanks for sharing, I'm glad to see you had the same idea as me, except, you got there first. I will see if I can help at all with the emonlib port. I am aware of the 0-1v range, but I don't think this is a problem at all. You just need to be more careful about the range you select for the ct sensor via the burden resistor, and select the resistors for the voltage divider accordingly.

juanpintom commented 9 years ago

Hi! :) Your help on porting this library is really appreciated :) I actually use on some nodes the ADC pin to meassure lux with an LDR, I use a Voltage divider with 220 and 100 ohm resistors, and a pull down resistor, more info here: (on Lux Sensor section) https://github.com/juanpintom/Souliss_ESP_Examples/wiki But I haven't time now to port the library, I have a node with ESP+ATTINY for two or three weeks with no problems :)

Regards