nodeMCU dimmer/switch/temp.sensor without arduino

9 years 8 months ago - 9 years 8 months ago #841 by cdj
AND FINALLY I WOOON !!!!!!!!!!
:woohoo: :woohoo: :woohoo: :woohoo: :woohoo:

All the code above is working, it is only a FCKD Firmware problem !!!

With nodemcu_20150123 it works perfectly at first time!!!

Thanks all for help!
A particular thanks to Dennis and Vladimir Dronnikov !
The following user(s) said Thank You: Dennis

Please Log in or Create an account to join the conversation.

9 years 8 months ago #850 by Dennis

Please Log in or Create an account to join the conversation.

9 years 7 months ago - 9 years 7 months ago #1034 by cdj
Hey Dennis, have you seen last nodemcu sensor from EasyIOT? I suppose that we can use API as this post and realize node without automation program ! What do you think about? With your code i've the problem of decimal (remember, if i divide in lua code, value arrive rounded, dunno why, ex: lua read temp 234 and when we send value/10 arrive temp 23 and NOT 23.4 in easyiot) and i've put /10 in automation code. And it works with some string - to float - to string conversion. But in this way i don't understand why i have a strange graph report as you can see in this post .
What do you think about it ?
Thanks for your time
Dario

EDIT : A stupid question : in your script there's also a SWITCH button to turn on/off things... but always with mosfet right? and always 12v ? or we can attach a 5v relay to it for example? thanks

Please Log in or Create an account to join the conversation.

9 years 7 months ago - 9 years 7 months ago #1036 by Dennis
Hello Dario,

it depends :)
For sensors, it is probably best to use the http API and have the node upload its data to easyIoT server. For actors like relay or MOSFET, it is better to use automation program.

I have been very busy with real life work lately, but plan to do something with DS18B20 sensors in the coming weeks, most probably using the HTTP API to update virtual nodes from the sensor directly/without polling it, as shown by easyIoT in his door switch example.

Also I just "discovered" that some smart people added esp8266 support to arduino IDE (so one can write code in arduino C instead of Lua, also use classic arduino libs like dallastemperature or DHT11), and I'll try this too.

Also, I designed some experiment PCB for esp8266-01 modules and ordered 10 pcs from china, and they look pretty good quality-wise, and even work as expected - with up to two MOSFETs, FW programming jumper, UART incl. level shifter, and both GPIOs broken out as connectors, one of them optionally for 1-wire too, if pullup resistor is soldered.

About SWITCH button: yes, intended use is with MOSFET - it sets pwm duty cycle to zero or full, so the result is equivalent to switching a GPIO, and thus it SHOULD also work when a relay is connected instead of the MOSFET. But of course you could easily replace the pwm command with simple GPIO switching command in Lua.

edit - if you connect the mosfet sorce and drain to 5V it will also work, they can take up to 55V in case of IRLZ44N mosfet for example. But you can use simple transistor to switch 5V for the relay, no need for mosfet when no dimming is needed (although it will work with one)

regards

Please Log in or Create an account to join the conversation.

9 years 7 months ago - 9 years 7 months ago #1055 by cdj
Great Dennis, i've print some pcb here in my lab but with simple resistors as level shifter for reset and rx with arduino. But I don't really understand why hardware fail lots of time. Done one pcb with bmp and esp to connect to easyiot touch screen thermostat and it doesn't work neither with mega nor with nano. Checked circuit 1 millions time, done with easyiot directive, ams1117 working ,changed capacitors and resistors and it doesn't work. Tried old and new firmware with new easyiot library...Tried real mega serial @115200 with firmware @115200, real mega serial @9600 with firmware @9600, software serial with nano.... Always same result: firmware respond with ai-thinker blabla and then TIMEOUT....happy easter :-)

Please Log in or Create an account to join the conversation.

9 years 7 months ago #1065 by Dennis
I've no idea why your pcb does not work, you should use a multimeter with continuity test to find possible shots or missing connections. But regarding strange sensor values after doing calculation in automation; what about using

float calculatednumber = (Single.Parse(stringvalue) / 10);
( msdn.microsoft.com/en-us/library/2thct5cb(v=vs.110).aspx )

instead of "Convert.toSingle(string)", in your automation code? Also, are you sure that the numbers arrive in good format at your server, i.e. the node is not making the error? Maybe do a serial.print on the received value before starting to calculate with it, then you can see if you receive faulty number...

regards

Please Log in or Create an account to join the conversation.

Time to create page: 0.283 seconds

Forum latest

  • No posts to display.