Ideas needed please

mm! It does rather but a lot of bang(good) for your buck eh?

Reply to
Bob Minchin
Loading thread data ...

When I wanted a microcontroller for something a good few years back, the first PI was still vapourware and it was exactly your argument about popular platform and readily available support that pushed me towards Arduino and I've stayed there since.

Reply to
Bob Minchin

FWIW I'm running a couple of the Raspberry Pi Zero W's

formatting link

One is nearly doing what you want in that it's running a webserver and acting as a data (Weather) acquisition unit (Domoticz).

formatting link

I believe it (Domoticz) does have the option for other inputs but I'm not sure about triggering outputs without using one of the home management systems (but I'm sure it must be doable without).

My other RPi Zero Z runs as a wireless print server for my Dymo label maker. ;-)

Cheers, T i m

Reply to
T i m

Having looked at whats on offer I think the beaglebone black would be my choice.

Ethernet, analogue IO and runs debian or ubuntu.

A little bit of glue code whould do all you need

Reply to
The Natural Philosopher

banggood is ok. I bought my laser cutter from there and didn't get charged any duty or vat when it arrived.

Reply to
dennis

Don't worry, you haven't missed out on a new model and it didn't take much working out I mean to put a 'W', like I did above a few times. ;-)

I think the RPi / Arduino question is a function of how much (easy / cheap) I/O do you want to do versus running 'A PC'?

eg. With an Arduino you don't have to deal with an OS, running on a SD card (that can get corrupted) and takes much longer to boot than the near 'instant on' of an Arduino.

I've never used a RPi for any I/O work, partly because I have plenty of Arduinos and tend to use the RPis for what they were designed to be, a tiny 'Computer' (running a desktop grade OS), rather than just a micro controller that once programmed, just does what it says on the tin (with no need for much in the way of maintenance, updates or considerations re powering them off etc).

Whilst I'm no programmer it's pretty obvious how you do so on an Arduino, especially say reading a voltage on a pin or toggling an output, I wouldn't know where to start doing the same on a RPi (I could find out of course, if I wanted to).

The last thing is price ... the average RPi is more expensive than yer average Arduino (especially the non 'Arduino' ones) and the addons seem to be more expensive as well. That may not be an issue if you are just doing stuff for the S&G's or you are using it for a RW job (like my OMV server with 3TB external drive) but can if you need several of some project.

Further, with an Arduino you can build one up from scratch to just do what you want, or embed in some existing kit etc.

Cheers, T i m

Reply to
T i m

PIs and Arduinos are quite differnt the Pi is more of a computer the arduin os are more for interfacing with external logic. Now there;s lots of cheap versions of both now. The Elgoo UNIO's our studen ts are buyoing at £7.99 seem OK. There's the orangepip versions too.

Reply to
whisky-dave

My ESP8266's arrived today (actually NodeMcu DevKIT ESP8266 12E V3) and have just used the sketch from here:

formatting link

The serial monitor shows it connecting to your WiFi and then the ip address it has gained using DHCP and when you connect to it from a web browser, you get a couple of On Off boxes on screen and when you toggle them, it changes the status indication of the output, 'Led pin is now = On (or Off etc, not tested that physically as yet).

So, toggling an output from a web browser looks easy so it would just need to analogue read added in to make it do what you wanted?

Cheers, T i m

p.s. For those who might be able to help Bob with the code easier than I, this is it:

#include const char* ssid = "Magesh"; const char* password = "jayakumar"; int ledPin = 13; // GPIO13 WiFiServer server(80); void setup() { Serial.begin(115200); delay(10); pinMode(ledPin, OUTPUT); digitalWrite(ledPin, LOW); // Connect to WiFi network Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); // Start the server server.begin(); Serial.println("Server started"); // Print the IP address Serial.print("Use this URL to connect: "); Serial.print("http://"); Serial.print(WiFi.localIP()); Serial.println("/"); } void loop() { // Check if a client has connected WiFiClient client = server.available(); if (!client) { return; } // Wait until the client sends some data Serial.println("new client"); while(!client.available()){ delay(1); } // Read the first line of the request String request = client.readStringUntil('\r'); Serial.println(request); client.flush(); // Match the request int value = LOW; if (request.indexOf("/LED=ON") != -1) { digitalWrite(ledPin, HIGH); value = HIGH; } if (request.indexOf("/LED=OFF") != -1) { digitalWrite(ledPin, LOW); value = LOW; } // Set ledPin according to the request //digitalWrite(ledPin, value); // Return the response client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println(""); // do not forget this one client.println(""); client.println(""); client.print("Led pin is now: "); if(value == HIGH) { client.print("On"); } else { client.print("Off"); } client.println(""); client.println("Turn Off "); client.println(""); delay(1); Serial.println("Client disonnected"); Serial.println(""); }

Reply to
T i m

They're quite impressive little devices, aren't they? more the glorified micro-controller end than the shrunken computer end of the scale.

Obviously the ESP32 has been around for a while (I've got one on order with a tiny OLED screen on-board) b

Reply to
Andy Burns

Yeah. ;-)

Quite ... and 'better' if you don't need 'a computer' (to maintain) as such.

Yeah, I saw that when looking myself.

The first sketch I tried was a WiFi scanner but the second (that I mentioned) worked initially and then nothing. I'll try it again in a mo but it might have just been a bad one.

I'll also hook up one of my relay boards and actually drive something (like a table lamp) and maybe a LDR or I2C temperature sensor.

Cheers, T i m

Reply to
T i m

For that application, the ESP8266 SONOFF boxes are about 4 quid on eBay. Complete with relay, etc. They are meant to work with a mobile app, but trivial to stick different firmware in.

Reply to
Bob Eager

{Confused} Sorry Bob, do you mean they can do both things (simultaneously) or that they are just an easy way to get a WiFi / remote light switch ... or summat else?

Cheers, T i m

Reply to
T i m

Its just an ESP8266 variant in a box with PSU and relay. There will be spare I/O pins but you probably need to solder a lead on to put the sensor on. Then program it..

formatting link

Reply to
dennis

Thanks very much Tim Yesterday I ordered one of these

formatting link

It will be a few weeks coming from china - I have other less interesting jobs to do first anyway I will certainly try your code.

Best Wishes Bob

Reply to
Bob Minchin

Ah, now it makes sense. So a 'hackable appliance' as such.

Np.

Cool, that does seem to be a 'tidier' way of relay switching something as all that stuff is built in (as Bob suggested) and as long as you still had the full use of the I/O stuff as well, could be a handy base.

I think I've already got one of the USB / Serial modules from the basic Arduino / ATMega chip projects.

Cheers, T i m

Reply to
T i m

WiFi remote mains switching. All in one box! Start here - links to other relevant bits:

formatting link

Reply to
Bob Eager

I've not used any Sonoff devices, but tasmota seems to be popular replacement firmware, possible to replace it over the air, rather than needing a serial console ...

Maybe node red on a Pi to act as centralised control for a whole fleet of such devices?

Reply to
Andy Burns

Yes, I saw mention of that and will check it out further.

I guess it all depends if you want to go with the whole Home Automation thing or not. I know my mate has a couple of lamps that can be controlled from their Amazon Echo but I really only see that as a bit of a gimmick.

Whereas, we have had Swish electric curtains for many many years (since we has dogs and had a light coming on in the evening) but now the LCD has gone on the controller. Now I may be able to fix it (not looked) or I can get it fixed for £65 or I could replace it with an Arduino, an RTC, LCD (although not essential as it could just be reprogrammed twice a year) and a couple of relays and a current sensor (to manage the end stops / overloads).

Maybe a Sonoff could be the heart of something with it being 'set' from a web browser or overridden with a phone app etc?

Cheers, T i m

Reply to
T i m

You are welcome. ;-)

They are cheap enough eh. ;-)

I've often had stuff arrive faster from China than the UK? ;-(

I think it helped (me) to have played with Arduino stuff quite a bit previously as configuring the Arduino IDE to the ESP was a bit more complicated than most straight Arduino boards (and that included adding the support for the extra boards in the first place).

Then after a couple of glitches (I tend to just 'experiment' my way though such things with a quick research when I'm not particularly sure) but had first the WiFi network scanner and then the WebHost / switch working pretty quickly (and both units seem to be ok after all).

I want to put an LED or relay on it just to see it actually doing something from a mouse click. ;-)

Cheers, T i m

Reply to
T i m

Yes, it might be interesting, but I think I'm quite content with light switches that go 'click' and don't need a linux box, UPS, switch and access point to work ...

Reply to
Andy Burns

HomeOwnersHub website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.