Idea: Espruino PLC #6667
Replies: 1 comment
-
Posted at 2019-12-27 by Robin Fri 2019.12.27 Okay, I'll bite @thijsmans, but I'll need to be educated on why the current breakout boards are not already the heart of a PLC, sans the necessary connector (and possible drivers) hardware.
Instructions for Espruino and WIZ550io here: The sample code snippet provided is pretty much how all the current tutorials could be wrapped, to provide that simplicity, should they not be at that level already. A $10 plastic case, along with $2 connectors and the desired $4 digital or analog amplifier boards if necessary would keep the entire project well under $100. What is preventing the goal you seek? Posted at 2019-12-27 by @allObjects the removal of the CC3000 support was for space reason... Espruino grew since the beginnings quite a lot... an the CC3000 is at its life end by TI's declarations... and mine is collecting dust... (at leat the box it is in). Whether WIZ550io is included in every build... I don't know... but adding it - and dropping something else you are not interested in - should be not that a big thing. Take a look at @jumjum's online build support... I see your point of reliability on communication. As much as wired is a good thing, it can also be a bad thing... being wired with WiFi / BLE kicking in as backup could be an option... Posted at 2019-12-28 by Thijsmans
They could most certainly be the heart of a PLC. I guess the problem is that I've got an idea, but not a detailed and solid plan. Neither do I have extensive knowledge about electronics ;-) Especially the modular setup looks complicated... Found this thread about serial communication between Pico's, which could be useful. @allObjects thanks for the tip! Posted at 2019-12-28 by @allObjects
And they are - not just the heart - but the complete PLC. The question is how you program them. From your comments I conclude that you expect a higher level of - or more dedicated - sway of programming. Looking at what JS already brings to the table and the interrupt driven implementation in Espruino as Hardware, Firmware and Software components / modules, it is already way towering over practically any other (general purpose) micro controller on the market -and even PLCs. And when you would have to pay usage license for what @gfwilliams and the community have put together, € 600 can be considered 'change'. Said so, does not mean I do not understand what you try to say or the point you make is not taken. Developing a next layer / level of programming with a PLC language that is interpreted by a PLCL interpreter is kind of an answer but it breaks the resource budget - memory, cycles, power consumption - these micro controller platforms have to offer and are targeting... Even a Raspberry Pi may reach its limits thinking of something like that. A system the way you have an idea of I can see implemented the following way:
Doing something like that non-commercially is quite an exercise... I don't say it is not feasible, but it is a lot of work... and while you settle for a set of sensors, satellite and center configuration and the implementation, these components evolve and settlement becomes pretty quickly outdated. This should not discourage you at all to begin with something... You can even run Espruino on the Raspberry Pi (I do though not know about communication support). Start to create a PLC as JS 'class' / prototype that you extend over time with what you need and implement. You come up with some JSON that describes your control definitions that you can send to the PLCs running on each of the satellites of MQTT. Said that, the PLC has core functions to understand receiving such descriptions / configurations, put/update them in place, and start and stop their operation. This is in addition to the operational functions that move control to and data from the PLC control entities and sensors. Posted at 2020-01-06 by @gfwilliams Well, you could do a hacky PLC right now using a Pixl.js with an Ethernet shield and relay shield? Just not DIN-mount. WIZnet support is built into some devices and builds, but can be added pretty easily to others. It still uses a lot of memory so I'm afraid it's not in all the time. I am actually looking at doing a small PLC type Bluetooth device (8 IO channels, 1A per channel, 3-18v voltage) that was originally planned to KickStart along with Bangle.js (I just ran out of time!). It wouldn't have Ethernet, but would have IO that could easily be connected to a WIZnet device, and I guess a shield could be made to make that process nice and easy if it was popular :) Posted at 2020-01-06 by AkosLukacs
If you start with a Pixl, Just google arduino DIN-mount. :) Posted at 2020-01-12 by Thijsmans Thanks for all thoughts! I have done some thinking about hardware and code. About the hardware:
As for as the actual javascript, I'm using several classes (* = not started yet, waiting for parts):
The 128x64 oled was a tad too small, a 320x240 LCD is in the mail. By using a seperate class with standard functions (mainly .bootscreen() and .update() ), changing the screen should be fairly easy. Hell, you could connect different screens at the same time, if you want to. About the modular setup, mentioned before... Let's see how a single unit works out first ;) Posted at 2020-01-13 by @gfwilliams
Partially, yes. At the low end it's so they can run off a LiPo, and at the high end I wanted to ensure you could run it in a car/boat/caravan/etc as well. Car battery + solar is a really easy way to get loads of power for various outdoor applications, and you can get a bunch of high power relays that run off 12v too. But yeah, if it's possible to keep mains voltages away from the same PCB as the microcontroller it's just easier all around... Plus if I made something that handled mains, there's no way it could also run off a LiPo battery and be useful. The other way around you can always use a power supply and relays pretty easily. Posted at 2020-03-27 by nikmartin And just FYI, I know this is an Espruino forum, but there's an actual Arduino PLC now, I have one and it's awesome. https://www.automationdirect.com/open-source/home I have the CPU, IO, and Ethernet shield with it. Posted at 2023-01-08 by @yerpj Seems to be quite an old thread... Did anyone make sort of a PLC running on Espruino? Posted at 2023-01-12 by @yerpj Just to mention: I just discovered this really cool open PLC project which provides an IDE and runtime environnment for PLC applications. What I found really interesting is its ability to extend inputs/outputs on various targets through modbus. One can use arduinos, ESP8266, ESP32, raspberry pis, ... to create a distributed PLC system. I think at some point it would be of interest to provide compatibility between Espruino and this project, just because Espruino hardwares are really good devices and can provide useful features like sensing (with puck.js) or displaying (pixl.js) that could help people building home automation applications. Of course Modbus is the key for interactions right now but maybe at some point if it could be extended to BLE as well it would make sense. Posted at 2023-01-13 by @gfwilliams That looks neat. I seem to recall I had some code for Espruino that did Modbus (there's not much to it - it's just Serial + ensuring you de-assert a pin when you're done transmitting if I recall). But personally, I never had a chance to do a PLC. It might have sold a few but I never had enough requests that it seemed it'd be worth the development effort. Probably the best bet now is find an ESP8266/ESP32 PLC device and run Espruino on that. It looks like Shelly have an ESP32 one at least Posted at 2023-01-13 by @yerpj Sure, my idea was not to create a PLC out of Espruino, but rather to expand a PLC system (such as one made with Open PLC Project) with distibuted sensors/actuators which could be Espruino devices. At some point I will probably try to write a module capable of exposing ressources through a Modbus RTU client. This way, one could bind physical ressources (sensors, actuators) with the Modbus registers for a remote access. To be eventually continued... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-12-27 by Thijsmans
Over the last year, I have been thinking about home automation on a higher level then Sonoff (limited lifetime) or 433mhz (limited possibilities) or even wifi (stability issues). Serious automation is usually done with a PLC (Programmable Logic Controller). These come with a price-tag: a Wago PLC with software license easily sets you back € 600. Cheaper options include a Railduino or Controllino, but as the name suggests, these have to be programmed with the Arduino IDE. I guess I just miss the ease of an Espruino PLC :) How cool would it be to program a PLC with something like this:
The PLC should have an ethernet-port (not wifi) to interface with (for example) Home Assistant, spitting out JSON over a websocket when the plc-class runs an event (like spinning the rotary, in the example above). And the other way around: the plc-class should be accessable over the websocket by feeding it JSON.
For future expansions, I would opt for a module based system: a main CPU in a plastic case with a small number of inputs and outputs (analog and digital), and optional modules for specific purposes (4 x input, 4 x output, 0-10v output...). The modules would connect to eachother with a USB-like connector system.
Gordon, any chance of an Espruino PLC happening? Or even a native ethernet Espruino? I would buy (both!) ;-) Untill that time, it seems that an Espruino Original could do pretty much everything I want it to, when combined with a WIZ550io. Does that still require the special build, even though the CC3000-support was removed from Espruino (and the lack of memory should no longer be an issue)?
Any thoughts on this would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions