Fun with ChatGPT

Unless if you’ve been living under a rock, you’ve probably heard of ChatGPT by now, if you haven’t given it a try yet. Over this past weekend, I’ve had some fun with it. Not only it’s amazingly good at writing text description, but it can write programming solutions too. Here are just a few things I asked it to do.

Ray: tell me about opensprinkler

ChatGPT: OpenSprinkler is an open-source, web-based sprinkler controller for watering gardens, lawns, and other outdoor areas. It allows users to automate their irrigation systems and customize watering schedules through a web interface or a smartphone app. The controller can be programmed to turn on and off sprinkler valves at specified times, and can also be integrated with weather data to adjust watering schedules based on local weather conditions. OpenSprinkler is designed to be easy to install and use, and is compatible with a wide range of sprinkler valve systems.

Ray: tell me more about opensprinkler

ChatGPT:

OpenSprinkler is a sprinkler controller that allows users to automate their irrigation systems and customize watering schedules through a web interface or a smartphone app. The controller is connected to a network and can be accessed remotely, allowing users to control their irrigation systems from anywhere with an internet connection.

In addition to being able to set custom watering schedules, OpenSprinkler also offers a number of advanced features that make it easy to optimize watering schedules and conserve water. For example, the controller can be programmed to turn on and off sprinkler valves based on local weather data, such as temperature, humidity, and precipitation. This helps ensure that plants are watered at the optimal times, while also minimizing water waste.

OpenSprinkler is compatible with a wide range of sprinkler valve systems, making it a versatile choice for homeowners and gardeners. It is also easy to install and use, with a user-friendly interface that makes it easy to set up and customize watering schedules.

Overall, OpenSprinkler is a useful tool for automating and optimizing irrigation systems, and can help homeowners and gardeners save time and resources by ensuring that their plants are watered efficiently.

Ray: tell me about opengarage

ChatGPT:

OpenGarage is an open-source, WiFi-enabled garage door opener that allows users to remotely control their garage doors using a web interface or smartphone app. It consists of a microcontroller board with an embedded web server and a relay, which is used to activate the garage door opener.

Users can access the OpenGarage controller through a web interface or smartphone app to open and close the garage door, as well as set custom schedules and receive notifications when the garage door is opened or closed. The controller can also be integrated with other smart home devices, such as home security systems or smart lights, allowing users to automate their garage door functions and create custom scenes.

OpenGarage is designed to be easy to install and use, with a user-friendly interface and a range of customization options. It is also open-source, which means that the software is freely available for users to modify and customize to meet their specific needs.

Overall, OpenGarage is a useful tool for automating and controlling garage doors, and can help users save time and effort by allowing them to remotely access their garages from anywhere with an internet connection.

Ray: what’s unique about opengarage

OpenGarage is an open-source, WiFi-enabled garage door opener that offers a number of unique features and benefits compared to other garage door openers on the market. Some of the key features and benefits of OpenGarage include:

  1. Open-source: One of the key features of OpenGarage is that it is open-source, which means that the software is freely available for users to modify and customize to meet their specific needs. This allows users to easily add custom features or modify the controller to work with specific garage door systems.
  2. Remote access: OpenGarage can be accessed remotely through a web interface or smartphone app, which allows users to control their garage doors from anywhere with an internet connection.
  3. Customization: OpenGarage offers a wide range of customization options, including the ability to set custom schedules, receive notifications when the garage door is opened or closed, and integrate with other smart home devices. This makes it easy for users to automate their garage door functions and create custom scenes.
  4. Compatibility: OpenGarage is compatible with a wide range of garage door systems, making it a versatile choice for homeowners.
  5. User-friendly interface: OpenGarage has a user-friendly interface that makes it easy to set up and customize garage door functions, even for users who are not technically proficient.

Overall, OpenGarage is a powerful and flexible garage door opener that offers a wide range of features and customization options to help users automate and control their garage doors.


As you can see from above, it’s really quite good at generating text descriptions. What’s more incredible is its ability to generate programming code. For example:

Ray: write a jquery program with three buttons, when the first button is clicked, draw a circle, when the second button is clicked, draw a square, when the third button is clicked, draw a face

In this case, the chat engine stopped a few times, and I had to type ‘continue’ to let it finish the program. But after it’s done, it generated a proper Javascript program, when you run it, it pops up the following interface. The circle and square are both drawn perfectly, the face is a bit of a failure, but it’s amusing to see it even produced comments in the code to document how the code draws a face.

I was pretty mind-blown by its capability. As a text generation engine, it’s clearly not just memorizing things, because if you ask it the same question again it will give you a somewhat different answer. I’ve also tried a number of other things, as listed below. Some are more successful than the others.

  • tell me about opensprinkler, in Shakespeare style
  • write instructions to create an IFTTT applet for OpenSprinkler
  • write an Arduino program for ESP8266 to connect to opensprinkler.com
  • write an Arduino program for ENC28J60
  • write a C++ program that uses a circular queue to implement a log

If you want to make changes or correct any mistakes, you can have a conversation with it. Such as ‘change the variable x to y’; ‘rewrite the second paragraph to use less words’, ‘your circular queue implementation is wrong, blah blah blah’.

To a University Professor like me, this is going to have a profound impact on how classes are to be taught, how homework is to be assigned, and how cheating cases are to be detected in the future. I mean, not only it can produce essays, but it can generated reasonably complex program code. A lot of the introductory level programming tasks can be easily solved by it. Well, at least for now, I am glad we can leverage this incredible tool for ourselves to write text descriptions, instructions, and sample programs. Have fun with it!

Announcing OpenSprinkler Firmware 2.1.0 (Major Upgrade)

I am excited to announce that OpenSprinkler Firmware 2.1.0 is officially release. This is a major upgrade that includes a number of new features, including:

  • Automatic Weather-based Water Time Adjustment using real-time weather data obtained from Wunderground (thanks to Rich Zimmerman who introduced the method, the adjustment method is named after him).
  • Improved Program Settings including per-station water time, flexible start times, custom name, per-program weather adjustment control, and up to 14 different programs.
  • Automatic Timezone and DST Detection based on your location. No need to select time zone and mess with DST any more — once you set your location, the firmware can automatically determine your time zone and DST.
  • Improved Station Attributes and Scheduler including station ‘disable’ attribute, ‘activate relay’ attribute, test station feature (replacing the previous manual mode), automatic serialization of overlapping schedules, and the ability to manually start a program on the controller using buttons.
  • Numerous UI Improvements (thanks to Samer’s hard work) including unified mobile interface, export / import configurations, improved visualization of logging data, and the number of supported languages has expanded to 17 (thanks to all who contributed)!

This is a pretty major milestone as it not only addresses the previous limitations but also introduced critical new features including weather-based control. Furthermore, consider all these are implemented on a small microcontroller with only 64KB flash memory and 4KB RAM 🙂 These significant changes are worth making a new video for. So here is the video tutorial for firmware 2.1.0 (it’s a bit long, but gives you a comprehensive overview of the main features);


Documentation

With this firmware I’ve also written a more detailed user manual, and API documentation. These are available on the Support page of our new website www.opensprinkler.com. In addition, there are a total of 4 tutorial videos that walk you through the hardware installation, WiFi connection, firmware features, and upgrading firmware. Be sure to check them out first.


Upgrade to Firmware 2.1.0

All OpenSprinkler 2.x devices (including 2.0, 2.1, and 2.2) are eligible to upgrade to firmware 2.1.0. Please check the ‘Firmware Update’ instructions on the support page to download and run the firmware updater. OpenSprinkler 2.0 and 2.2 are the easiest as drivers are pretty straightforward to install, and there is no bootloading procedure; OpenSprinkler 2.1 is tricky because the driver installation is more involved, and there is a bootloading procedure you need to follow. In any case, the firmware upgrade tutorial video gives you a quick walk-through of all the steps.

To use the weather feature, you need to apply for a Wunderground API key. Again, instructions can be found on the support page.

Firmware 2.1.0 has gone through internal alpha testing and external beta testing, so it should be pretty stable. For issues and suggestions, please use the forum, or the support page to submit support tickets.


Implementation

When I say ‘all these are implemented on a small microcontroller with only 64KB flash memory and 4KB RAM’, it’s not entirely true — the weather feature and timezone / DST detection are actually implemented using Python scripts hosted at www.opensprinkler.com. Why? Because these require fairly heavy processing power that’s simply beyond the capability of a small microcontroller. So they are implemented by using Python scripts that serve as the ‘middle man’ — retrieving data from weather websites, perform the necessary parsing and computation, and produce the final results to send back to OpenSprinkler. This way the heavy computation is done in the cloud, and OpenSprinkler only needs to poll the server once in a while to update the results. If you are interested in customizing the scripts, you can download the Python scripts from OpenSprinkler Github repository, modify them and host them on your own server. But for most people the default provided script should work pretty well.


Upcoming Features

As this firmware has been rolled out, we are getting excited to decide on the new features for the next round. Some planned features include:

  • Additional station attributes including soil type, slope type, serial group.
  • Support to store programs and station settings onto the microSD card (effectively allowing unlimited programs).
  • Adding firmware support to interface with remote power sockets, so you can use OpenSprinkler to control power line devices like heaters, fan, Christmas lights etc.
  • Support to use sunset and sunrise times for program start times (the sunset and sunrise times are already being detected using the timezone / DST script).
  • Support for flow sensor to monitor water consumption.
  • Cloud support: no more messing with port forwarding.

Suggestions and comments are welcome. Please post them below, or on the forum. Thanks!

OpenSprinker1

OpenSprinkler Firmware Update Program 2.0

We’ve just released a new OpenSprinkler Firmware Update program, with a video tutorial to walk you through the steps of how to upgrade your firmware. Hopefully this will make it easy for users to transition to the upcoming Firmware 2.1.0, which has a number of significant new features and improvements.

The new update program is written in Qt, and does not rely on Java any more. It’s cross-platform just like before. It also supports downloading the latest firmwares from the OpenSprinkler Github repository, and auto-detect of your OpenSprinkler hardware version. If you are a Windows user (especially Windows 8 and 8.1), you will still have to go through the hassle of installing driver. The video tutorial shows you a step-by-step guide of how to install driver.

For those who are interested in modifying the OpenSprinkler firmware code, I am experimenting with CodeBender.cc, which is a cloud-based Arduino platform. It’s really convenient in that it’s essentially a web-based Arduino IDE that runs in a browser; it also make it easy for people to share their code and modifications. I think its convenience will likely lower the barrier of programming, and motivate more users to modify OpenSprinkler firmware code to add custom functionality. I’ve made requests to add OpenSprinkler to their list of supported boards. Hopefully I will hear back from them soon!

Rayshobby Products at Micro Center

They have a pretty large ‘DIY Electronics’ section with all sorts of electronic goodies. This is what I pictured RadioShack should be.

After searching around a few times, I found the AASaver, SquareWear, and OpenSprinkler on one shelf. Very exciting! I do wish they were better organized, because as is, there are hundreds of kits and gadgets spread everywhere like baby toys at a daycare center. Seeing them in store does give me a good idea how to package the products more properly in the future.

So if you are interested in OpenSprinkler (DIY kit), AASaver, and SquareWear, and if you have a nearby Micro Center store, go and check them out. They also take online orders. I wonder if RadioShack could have been saved if they had taken the lead in offering a wider variety of DIY electronics products. Alas, it may be too late.

MicroCenter1 MicroCenter2 MicroCenter3 MicroCenter4