Artificial Intelligence Runs On Arduino

Fundamentally, an artificial intelligence (AI) is nothing more than a system that takes a series of inputs, makes some prediction, and then outputs that information. Of course, the types of AI in the news right now can handle a huge number of inputs and need server farms’ worth of compute to generate outputs of various forms, but at a basic level, there’s no reason a purpose-built AI can’t run on much less powerful hardware. As a demonstration, and to win a bet with a friend, [mondal3011] got an artificial intelligence up and running on an Arduino.

This AI isn’t going to do anything as complex as generate images or write clunky preambles to every recipe on the Internet, but it is still a functional and useful piece of software. This one specifically handles the brightness of a single lamp, taking user input on acceptable brightness ranges in the room and outputting what it thinks the brightness of the lamp should be to match the user’s preferences. [mondal3011] also builds a set of training data for the AI to learn from, taking the lamp to various places around the house and letting it figure out where to set the brightness on its own. The training data is run through a linear regression model in Python which generates the function that the Arduino needs to automatically operate the lamp.

Although this isn’t the most complex model, it does go a long way to demonstrating the basic principles of using artificial intelligence to build a useful and working model, and then taking that model into the real world. Note also that the model is generated on a more powerful computer before being ported over to the microcontroller platform. But that’s all par for the course in AI and machine learning. If you’re looking to take a step up from here, we’d recommend this robot that uses neural networks to learn how to walk.

23 thoughts on “Artificial Intelligence Runs On Arduino

      1. This. ^

        When I was studying ML I was stunned by how “seat of the pants” everything was. You thought it would be these complex elegant proofs and then the professor says “oh, and if you’re curve looks off, just apply another log function to smooth it out …”

          1. Most of the mathematicians I know would argue that statistics is math without the rigour …

            And since LLM’s and all the wizbang genAI stuff is mostly stochastic …

      2. A linear regression model is not typically considered AI in the modern sense, though it is a fundamental statistical and machine learning technique. The distinction is

        Linear regression is a statistical model that:
        1. Finds a linear relationship between variables
        2. Has been around since the early 1800s
        3. Uses a fixed, simple mathematical formula
        4. Cannot “learn” or adapt beyond its initial training

        Modern AI typically refers to more complex systems that:
        1. Can identify intricate patterns
        2. Can adapt and learn from new data
        3. Often use neural networks or other sophisticated algorithms
        4. Can handle non-linear relationships
        5. Can work with various types of data simultaneously

      1. The creator is likely proud of their creation, and they should be! They made something to suit their needs and probably had fun doing it.

        It is although not very impressive. I am not being negative, but you cannot expect linear regression to impress the average hackaday user.

        The physical construction of the lamp from paper is more impressive to me, since I can barely cut in a straight line with scissors.

    1. It’s an odd choice to use linear regression. Knowing both the LDR response and the lamp brightness are likely not linear.

      Although I’m not sure what their response looks like! I’ll have to look that up today.

      This is only AI in the sense that all computers are AI. It does seem like a nice introduction to the idea of using models in their projects.

      I think most of us wouldn’t do this, we’d just map brightest LDR response and darkest then brightest and darkest lamp settings and use that. I don’t know if it’s Worse than the project but it’s less interesting for sure and less sophisticated.

      1. LDR, light source and visual perception are anything but linear and all of them have different spectral responses. The equation derived from the data set has just the quality of an educated guess and is only valid for the person who collected the data.
        In the real world, the proper runtime environment for this AI model would be a µA741. Adding two trimpots would allow to skip the data acquisition part. (A 555 could also be used, but that’s probably overkill).

        1. I’ve been umming and ahhhing about this all morning.

          If the regression is taking place off device then I’d say you’re right add in more complex outputs (more complex regression needed).

          If the regression will be a simple linear one then do it on device. An Arduino could easily run an ordinary square differences regression store the parameters in eeprom and allow recalibration in the future.

          I did a quick scan of the page if he had a GitHub link I’d contribute the changes gladly.

  1. Gotta be way more careful with the anthropomorphism.

    There is no prediction.
    No thinking.
    It isn’t guessing or learning.

    It is a search engine.
    A tool.
    But being complicated makes it hard to follow the steps.

    That’s all.
    No more.
    No less.

    Let’s not keep contributing to the mystique by using leading language.

  2. Fundamentally, an artificial intelligence (AI) is nothing more than a system that takes a series of inputs, makes some prediction, and then outputs that information.

    By that definition, a PID controller is AI.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.