Humble Arduino As PLC

On the surface, a programmable logic controller (PLC) might seem like nothing more than a generic microcontroller, perhaps outfitted to operate in industrial settings with things like high temperatures or harsh vibrations. While this is true to some extent, PLCs also have an international standard for their architecture and programming languages. This standard is maintained by the International Electrotechnical Commission, making it so that any device built under these specifications will be recognizable to control engineers and maintenance personnel worldwide. And, if you use this standard when working with certain Arduinos, this common platform can become a standard-compliant PLC as well.

The IDE itself supports programming ladder diagrams, functional block diagrams, and other programming systems covered under the IEC 61131-3 standard. Not only that, it allows the combination of these types of PLC programming with Arduino sketches. The system offers many of the perks of PLC programming alongside the familiar Arduino platform, and supports a number of protocols as well including CANOpen, Modbus RTU, and Modbus TCP. It can also be used for monitoring a PLC system, essentially adding IoT capabilities to existing systems, enabling continuous monitoring, debugging, and program updates.

While not every Arduino is a great platform to build a PLC around, there are a few available for those looking for a system a little less proprietary and a little more user-friendly than typical PLC systems tend to be. There’s a reason that PLCs are built around an international standard and generally have certain hardware in mind to run it, though, and this comparison of a Raspberry Pi with an off-the-shelf PLC goes into detail about why certain components aren’t good choices for PLCs.

Building A Weather Display In Rust

We’ve seen a lot of weather displays over the years, and plenty of the more modern ones have been using some form of electronic paper. So what makes this particular build from [Harry Stern] different? The fact that the firmware running on the ESP32 microcontroller at its heart was developed in Rust.

The weather station itself is capable of operating for several months on its rechargeable NiMH battery bank. The Rust section of the project is in two parts, the first of which runs on a server which downloads the weather data and aggregates it into an image. The second part runs on the ESP32 using esp-idf which configures peripherals, turns on and connects to Wi-Fi, retrieves the image from the server, displays the image and then puts the display to sleep. By doing the heavy lifting on the server, the display should be able to run for longer than it would if everything was happening on the ESP32.

The project code is available from this GitHub page which should allow even Rust beginners to follow along, and the case file is also available for those with a 3D printer. [Harry] has a few upgrades planned for future releases as well, including a snap-fit case, a custom PCB, and improved voltage regulator for better battery life, and enhanced error handling for the weather API. And Rust isn’t the only interesting part of this project, either. As prices for e-paper displays continue to fall, more and more of them are found in projects like weather stations and even complete laptops which use these displays exclusively.

Normal Users Don’t Code On Their Mac, But Apple Keeps Trying

Most people use their computer to run pre-packaged programs: usually a web browser, games, or office applications. Whether the machine is a PC or a Mac, they don’t generally write their own software. For them, the computer is an appliance, and they do what their computer allows them to do.

It shouldn’t have to be that way, if only programming were easier. The Eclectic Light Company has a fascinating article looking at the various attempts that Apple has made to lure their users into creative programming.

Probably the most familiar of them all is AppleScript, with its origins in late 1993. Or maybe you’re thinking of Hypertalk, the scripting component of 1987’s Hypercard. That would go on to be a mainstay of mid-1990s multimedia software, but while it’s fallen by the wayside it’s AppleScript which still has support in the latest MacOS.

The biggest surprise for us lies in the forgotten products. 1989’s Prograph graphical language looks amazing. Was it simply before its time? In the modern era, Apple describes the reach of Shortcuts diplomatically: “its impact has so far been limited”.

Maybe the most forward-thinking line on programming from Apple came in 2007, even if it wasn’t recognized as such. The original iPhone didn’t have any third-party apps, and instead developers were supposed to write web apps to take advantage of the always-connected device. Would that be such a bad piece of advice to give a non-developer writing software for their Mac today?

Programming A Poker Game With GPT Help

Although ChatGPT generated a huge amount of hype around replacing white collar workers completely when it was first released to the public, the general consensus now is that it won’t outright replace anyone yet, but rather people who know how to use it as a tool will replace those who don’t. Getting started with it is not too hard, either, but you’ll of course need a project to work on to familiarize yourself with the tool. [Volos Projects] gave himself the challenge of writing a poker game using ChatGPT not as the opposing player, but as a co-designer in order to learn more about it as an assistant.

The poker game is being built on an ESP32 board with a built-in AMOLED screen. Five buttons are wired to the microcontroller to allow the player to select which cards to discard and which to keep. The bet for each hand can be raised or lowered much like the tabletop poker games often seen in bars and restaurants. To program it, though, ChatGPT was used to help design the code at each step of the way, first describing the overall goal and then building each function one-by-one like shuffling the deck, dealing the hand, and then replacing and dealing new cards.

For anyone who hasn’t yet explored using ChatGPT to help design their programming projects, this effort goes a long way to showing just how useful a tool it can be. For more complex tasks, though, it does take a little bit of knowledge on the part of the user because ChatGPT can often turn out nonsense or factually inaccurate information, but at least in a programming environment you’ll generally find out quickly when that happens. It’s not just a useful tool for writing programs, either. It can accomplish a lot of ancillary tasks related to programming as well, even if it’s not writing the code directly.

Thanks to [Peter] for the tip!

Continue reading “Programming A Poker Game With GPT Help”

A New Educational Robotics Platform

When looking for electronics projects to use in educational settings, there is no shortage of simple, lightweight, and easily-accessible systems to choose from. From robotic arms, drones, walking robots, and wheeled robots, there is a vast array of options. But as technology marches on, the robotics platforms need to keep up as well. This turtle-style wheeled robot called the Trundlebot uses the latest in affordable microcontrollers on a relatively simple, expandable platform for the most up-to-date educational experience.

The robot is built around a Raspberry Pi Pico, with two low-cost stepper motors to drive the wheeled platform. The chassis can be built out of any material that can be cut in a laser cutter, but for anyone without this sort of tool it is also fairly easy to cut the shapes out by hand. The robot’s functionality can be controlled through Python code, and it is compatible with the WizFi360-EVB-Pico which allows it to be remote controlled through a web application. The web interface allows easy programming of commands for the Trundlebot, including a drag-and-drop feature for controlling the robot.

With all of these features, wireless connectivity, and a modern microcontroller at the core, it is an excellent platform for educational robotics. From here it wouldn’t be too hard to develop line-follower robots, obstacle-avoiding robots, or maze-solving robots. Other components can easily be installed to facilitate these designs as well. If you’re looking for a different style robot, although not expressly for educational purposes this robotic arm can be produced for under $60.

Bridging A Gap Between LLMs And Programming With TypeChat

By now, large language models (LLMs) like OpenAI’s ChatGPT are old news. While not perfect, they can assist with all kinds of tasks like creating efficient Excel spreadsheets, writing cover letters, asking for music references, and putting together functional computer programs in a variety of languages. One thing these LLMs don’t do yet though is integrate well with existing app interfaces. However, that’s where the TypeChat library comes in, bridging the gap between LLMs and programming.

TypeChat is an experimental MIT-licensed library from Microsoft which sits in between a user and a LLM and formats responses from the AI that are type-safe so that they can easily be plugged back in to the original interface. It does this by generating JSON responses based on user input, making it easier to take the user input directly, run it through the LLM, and then use the output directly in another piece of code. It can be used for things like prototyping prompts, validating responses, and handling errors. It’s also not limited to a single LLM and can be fairly easily modified to work with many of the existing models.

The software is still in its infancy but does hope to make it somewhat easier to work between user inputs within existing pieces of software and LLMs which have quickly become all the rage in the computer science world. We expect to see plenty more tools like this become available as more people take up using these new tools, which have plenty of applications beyond just writing code.

Contrary View: Chatbots Don’t Help Programmers

[Bertrand Meyer] is a decided contrarian in his views on AI and programming. In a recent Communications of the ACM blog post, he reveals that — unlike many others — he thinks AI in its current state isn’t very useful for practical programming. He was responding, in part, to another article from the ACM entitled “The End of Programming,” which, like many other articles, is claiming that, soon, no one will write software the way we do and have done for the last few decades. You can see [Matt Welsh] describe his thoughts on this in the video below. But [Bertrand] disagrees.

As we have also noted, [Bretrand] says:

“AI in its modern form, however, does not generate correct programs: it generates programs inferred from many earlier programs it has seen. These programs look correct but have no guarantee of correctness.”

Continue reading “Contrary View: Chatbots Don’t Help Programmers”