Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: What do we have to do to resuscitate micro Perl? I want Circuit Perl NOW!

by wjw (Priest)
on Mar 10, 2018 at 12:01 UTC ( #1210613=note: print w/replies, xml ) Need Help??

in reply to What do we have to do to resuscitate micro Perl? I want Circuit Perl NOW!

First off, I like the idea of being able to write micro-controller code in Perl, or as is more likely, having my Perl code converted to the subset of C(++) that is then compiled and uploaded to whatever micro-controller I happen to be using.

That said, and with the Yun being a retired product (and not so many affordable alternatives that I have found on the market), it may be a hard sell to get the time and effort put into something like this.

I 'mess around' with various micro-controllers, mostly the Uno, Feather, Trinket Pro, and the radio (RFM) capable modules. From a cost perspective as well as a 'division of functionality' perspective, I have found that an RPi connected to a micro-controller via USB does a fine job.

The RPi does the processing of incoming data, both receiving the data(Serial), processing it(using whatever I need from CPANm or whatever), and displaying it (apache2). This leaves all the more 'bloated' work to the RPi. The micro-processor just does what it is good at: and that is handle IO through the digital and analog ports, basic data manipulation(mostly math conversions like tempC to tempF or analog value to other measurement unit) along with some data organization such as formatting the output to JSON for transfer to the RPi.

For the money, it seems the most reliable approach right now. I have at times added the web-server to an Uno or Mega which works fine, but find that the overhead is really not worth the effort. It cuts down on the real power of the micro-controller, which is in my mind its ability to gather a lot of data very fast.

I really would like the ability to write Perl and have good controller code end up on the micro-controller. That would be a great advantage to me as I am no C(++) programmer. That tied in with the fact that the documentation of the libraries for some of the C code that has been written for the micro's just plain sucks, makes the idea of Perl for MC's really attractive.

I am no C programmer, don't really understand compilers in any meaningful way either. So my 'picture' of this is something like

  • 'Perl->C->existing C compiler->micro-controller'.
though the Arduino IDE. Not sure if that is what is being talked about here(sorry for my lack of in depth knowledge) but that seems to me like the most affordable approach based on the hardware available, the cost of that hardware, and the effort it would take to make Perl really usable as a language for micro's

I should probably clarify here that I have avoided using the RPi as a micro-controller, though I know that is often done via GPIO etc... . This is again, because of my bias of 'division of function', where I think of the RPi as a nice Linux box and the micro as a pure data-acquisition and device/sensor controller.

<Hope this is not too far off-topic...

...the majority is always wrong, and always the last to know about it...

A solution is nothing more than a clearly stated problem...

  • Comment on Re: What do we have to do to resuscitate micro Perl? I want Circuit Perl NOW!

Replies are listed 'Best First'.
Re^2: What do we have to do to resuscitate micro Perl? I want Circuit Perl NOW!
by ait (Hermit) on Apr 26, 2018 at 01:39 UTC

    Thanks for your comprehensive response!

    BTW there is a new Yśn which just came out. I think this will wind up being the best approach to IoT stuff. In other words the two-tiered approach with a WiFi chip running OWRT and an AVR running the actual control with a bridge between them just like the Yun has.

    I guess what I would love to see stripped down, lightweight Perl at the OpenWRT level for HTML-based UI development and MQTT and stuff like that. Some simple, fast, lightweight Perl combo that has some Web-UI development stuff and MTTQ stack too, plus some common crypto stuff.

    Also your approach using rbpi and an avr via serial is great too. But I think that the two tiered approach using owrt and the avr on the same board is awesome.

Re^2: What do we have to do to resuscitate micro Perl? I want Circuit Perl NOW!
by ait (Hermit) on Aug 30, 2018 at 03:01 UTC

    I just finished writing a single-file HTTP server with literally 1 required dependency (IO::Socket), running on the very resource constrained Atheros chip with OpenWRT on an Arduino Yłn (second generation) win under 200 lines of code. I would say that pretty much beats Python and Node.js by a wide margin, and the code is so elegant and slick. Well, of course, it's Perl ;-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1210613]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2020-12-03 08:27 GMT
Find Nodes?
    Voting Booth?
    How often do you use taint mode?

    Results (53 votes). Check out past polls.