Posts | Comments

Planet Arduino

Archive for the ‘Github’ Category

You can’t do much development without running into Git, the version control management system. Part of that is because so much code lives on GitHub which uses Git, although you don’t need to know anything about that if all you want to do is download code. [Dr. Torq] has a good primer on using Git with the Arduino IDE, if you need to get your toes wet.

You might think if you develop by yourself you don’t need something like Git. However, using a version control system is a great convenience, especially if you use it correctly. There’s a bug out in the field? What version of the firmware? You can immediately get a copy of the source code at that point in time using Git. A feature is broken? It is very easy to see exactly what changed. So even if you don’t work in a team, there are advantages to having source code under control.

If you are already using a more advanced IDE, Git is probably integrated into your environment, or, at least, it could be. If you are allergic to the command line, there are plenty of GUI tools to use Git, also. One nice thing about Git is that your local repository is just a directory. You don’t need to stand up a special server or anything to use it.

We don’t think it is directly related, but [Andreas] recently had a video on Git and Arduino. It isn’t as detailed, but it does have some good stuff and is worth the time to watch. You can see it below.

We’ve used Git for some odd things in the past. Note that Git is the version control system while GitHub is a website. However, if you are a hardcore command line user, you can manipulate GitHub from there, too.

Arduino Docs contributions through GitHub

As you know, Arduino is all about open source, and now our Docs and Help Center sites now join the community club becoming open-source. Arduino lovers everywhere can now contribute to the content on official Arduino documentation websites through their public GitHub repositories.

How you can contribute

You’ll need a GitHub account, since it’s all handled through the repository.

Head on over to the Docs repo or the Help Center repo. In the file list, you’ll see the “content” folder, which is the various pages are found. You might need to tunnel down through it until you eventually find the page you’re looking for, but it’s in there.

The content can be edited directly in GitHub, so there’s no need to download anything. Just make the changes, suggestions or contributions that you want. You can then create a branch and click the “Pull request” button, and your changes will be sent to the Arduino Docs team to be reviewed. If they’re accepted, you’ll be credited in the Git history for your contributions!

For the tutorial pages on the various boards hosted in Docs, you can find a shortcut to the correct file in GitHub. On the right hand side of the page you’ll see a new box, called “Suggest Changes”. The “Edit this page” button takes you straight to the relevant file in the GitHub repo, so you don’t need to drill down through the content folder to find it.

What you can contribute

It doesn’t necessarily have to be simple corrections or edits, either. If you want to submit your own tutorial or article, you can do so by forking the repository, adding your content there and eventually create a pull request.

Everything on the site is very carefully curated, so we can’t guarantee that contributions will be published, but you’re more than welcome if you feel you’ve something valuable to share. Make sure you read the guidelines and consider summarizing your proposal in the issue tracker before starting to write the actual content, to get feedback from our content team and the community.

So keep your eagle eye out on the repository for any opportunity to become a contributor and join the community!

The post Arduino Documentation Goes Open-Source for Community Contributions appeared first on Arduino Blog.

Arduino Libraries Submissions process update

Arduino library submissions have a new, easier and more transparent workflow.

Libraries are one of the pillars of the Arduino ecosystem. At time of writing, more than 3,780 open source libraries are available to perform any kind of task. This includes communication with external components and using algorithms for data processing. Such a variety of shared building blocks helps achieve things quickly without the need to write low-level code.

Beyond the official libraries maintained by the Arduino team, most are contributed by the community. Anyone can submit a new library for inclusion, provided it meets the specification and passes the Arduino Lint checks.

Note: Did you know you can run the tool locally to check the compliance status of your current libraries?

A new Arduino library submissions process

We’re happy to announce that the submission process for community libraries has been refactored. The goal is making it leaner, more automated and more transparent. Previously you would open an issue on the Arduino IDE repository for the Arduino team to handle the request manually. Instead, we’ve now established an official GitHub repository containing the library registry.

Submitting a new library is now as simple as opening a pull request to that repository. Then you add the URL of the library’s repository to the list. A bot performs automated checks and, when passed, the request will be merged immediately. Within one day, the new library will be listed in the Arduino library directory. It’ll also be made available within the IDE, the Arduino CLI command line tool and the Web Editor. The Arduino team will still be monitoring the process in order to fight abuses and to provide assistance.

After a library is indexed, new versions are automatically detected and published (if compliant). So nothing changes for existing libraries and no action is required. See the repository documentation for more details about the new process and join the discussion in the forum to provide your feedback.

Subscribe to the Arduino newsletter so you don’t miss any other exciting developments!

The post New workflow for Arduino library submissions appeared first on Arduino Blog.

GitHub Actions is the name of the SDLC (Software Development Life Cycle) system introduced by GitHub about a year ago, currently in public beta and now approaching the general availability status. When you read SDLC, think about some sort of CI/CD system that’s generic enough to let you define a sequence of operations not necessarily limited to build, test, and deploy code: GitHub Actions can help you automate processes in code reviews, issue triaging, and repository management.

GitHub Actions have been part of the tools we use at Arduino for a while now; helping us solve a wide range of problems from automating workflows within our backend infrastructure, to managing the release process of our open source software. In the spirit of giving back to the community, we started publishing some of the Actions we developed internally so that they can be used right ahead from any GitHub account that’s been granted access to the public beta of GitHub Actions, and eventually in any GitHub repository.

Our Actions are available from this repository and there’s one in particular we think the Arduino community will be happy to have – it’s called setup-arduino-cli and under the hood it takes all the steps necessary to have the `arduino-cli` binary available in a Workflow.  This means that in any step of your Workflow you can leverage the long list of features of the Arduino CLI.

# This is the name of the workflow, visible on GitHub UI.
name: test
 
# Here we tell GitHub to run the workflow when a commit
# is pushed or a Pull Request is opened.
on: [push, pull_request]
 
# This is the list of jobs that will be run concurrently.
# Since we use a build matrix, the actual number of jobs
# started depends on how many configurations the matrix
# will produce.
jobs:
  # This is the name of the job - can be whatever.
  test-matrix:
 
    # Here we tell GitHub that the jobs must be determined
    # dynamically depending on a matrix configuration.
    strategy:
      matrix:
        # The matrix will produce one job for each configuration
        # parameter of type arduino-platform, in this case a
        # total of 2.
        arduino-platform: ["arduino:samd", "arduino:avr"]
        # This is usually optional but we need to statically define the
        # FQBN of the boards we want to test for each platform. In the
        # future the CLI might automatically detect and download the core
        # needed to compile against a certain FQBN, at that point the
        # following include section will be useless.
        include:
          # This works like this: when the platform is "arduino:samd", the
          # variable fqbn is set to "arduino:samd:nano_33_iot".
          - arduino-platform: "arduino:samd"
            fqbn: "arduino:samd:nano_33_iot"
          - arduino-platform: "arduino:avr"
            fqbn: "arduino:avr:uno"
 
    # This is the platform GitHub will use to run our workflow, we
    # pick Windows for no particular reason.
    runs-on: windows-latest
 
    # This is the list of steps this job will run.
    steps:
      # First of all, we clone the repo using the checkout action.
      - name: Checkout
        uses: actions/checkout@master
 
      # We use the arduino/setup-arduino-cli action to install and
      # configure the Arduino CLI on the system.
      - name: Setup Arduino CLI
        uses: arduino/setup-arduino-cli@v1.0.0
 
      # We then install the platform, which one will be determined
      # dynamically by the build matrix.
      - name: Install platform
        run: |
          arduino-cli core update-index
          arduino-cli core install ${{ matrix.arduino-platform }}
 
      # Finally, we compile the sketch, using the FQBN that was set
      # in the build matrix.
      - name: Compile Sketch
        run: arduino-cli compile --fqbn ${{ matrix.fqbn }} ./blink

Example

Let’s say you keep your sketches in a GitHub repository, and you want to be sure that every time you push a git commit or you merge a pull request, the sketches compile correctly on certain boards you own, for example a Nano 33 IoT and a Uno. To keep the configuration at minimum, we can use a “build matrix”, so that GitHub will start a different job for each one of the platforms we list in the matrix, without the need to configure them explicitly.

You can find a working example here: https://github.com/arduino/arduino-cli-example

You can find more info and docs for the Action on the GitHub Marketplace: if you like it, please leave us a star!
We’re eager to hear your feedback, feel free to hit the Action repository and open an issue should you find any problem, or a feature request in case you want more from the action.

[W8BH] attended a talk by another ham, [W8TEE] that showed a microcontroller sending and receiving Morse code. He decided to build his own, and documented his results in an 8 part tutorial. He’s using the Blue Pill board and the resulting device sends code with paddles, sends canned text, provides an LCD with a rotary knob menu interface, and even has an SD card for data storage.

All the code is on GitHub. If you are interested in Morse code or in learning how to write a pretty substantial application using the Blue Pill and the Arduino IDE (or any other similar processor), this is a great exposition that is also a practical tool.

[W8BH] takes good advantage of breakout boards with things such as the displays and jacks on them. Of course, you don’t absolutely have to use those, but it does make life easier. You can see [W8TEE’s] version posted in an online forum.

The parts of the tutorial all build on each other, so you start out simple and get deeper and deeper. The tutorials are PDF files, but they are well organized and easy to read.

We’ve done our tutorials and videos on the Blue Pill. If you don’t want to rely on the Arduino IDE, there are ways around that, too.

Blue Pill header pic: Popolon [CC BY-SA 4.0]

All of the tools you need to work with the FPGA Arduino — the Vidor — are now in the wild!

We reported earlier that a series of French blog posts finally showed how all the pieces fit together to program the FPGA on the Arduino MKR4000 Vidor board. Of course, I wasn’t content to just read the Google translation, I had to break out the board and try myself.

I created a very simple starter template, a tool in C to do the bitstream conversion, required, and bundled it all together in one place. Here’s how you can use my starter kit to do your own FPGA designs using the Vidor. I’m going to assume you know about FPGA basics and Verilog. If you don’t, why not check out the FPGA boot camps first?

The first thing you’ll want to do is grab my GitHub repo. You’ll also need the Arduino IDE (a recent copy) and Intel’s Quartus software. Inside, you’ll find three directories, two of which contain slightly modified copies of original Arduino files. But before you start digging in, let’s get the high-level overview of the process.

Basic Concepts

The FPGA onboard the Vidor is an Intel/Altera device so to configure it, we’ll use Quartus. Usually, Quartus handles everything including programming the device, but we can’t use it for that with the Vidor. Instead, we will have to tell the CPU how we want the FPGA configured and it will do it for us as part of our Arduino program (I really hate saying sketch).

Quartus (see below) will take our Verilog files and create a ttf file that represents the configuration bitstream. This is just an ASCII text file full of decimal numbers. Unfortunately, the way the Vidor is set up, it needs the numbers bit reversed at the byte level. That is, 01 in the ttf file needs to be 80 hex sent to the FPGA.

Arduino supplies a Java class file to do the task, but I got frustrated because the class file needed Java 11 and I didn’t want to put it on every machine I use, so I just rewrote it in C. It is easy enough to port the algorithm, though. In the shell subdirectory, I have another example implementation using awk.

Once you have this stream of numbers, you can include it in an Arduino sketch with some boilerplate to enable the FPGA and load it. The standard program includes the file app.h which is just the output of the conversion program. There’s no C code in it, just comma-separated numbers that the main code will stick in an array at compile-time. Beyond that, it is a normal Arduino program and you can do what you like. Upload it and you’ll get the CPU and FPGA programmed all in one go.

There is one caveat. The FPGA code has a top-level block with lots of I/O pins defined and the corresponding constraints. You should be very careful not to change these or alter the pin constraints. If you drive a pin that’s already an output, for example, you could do real harm to the board. Because all the pins are shared, you have the same problem with the Arduino pins, too. If you are driving an output pin with the FPGA, you shouldn’t try to drive it with the CPU also. However, as you will see, it is perfectly fine to have the FPGA reading a pin from the CPU or vice versa. That’s good because it gives us a way to send data back and forth between them.

On to Code

I wanted something simple, and I didn’t want to accidentally modify the Arduino boilerplate Verilog. You could instantiate a Verilog module, but this would require passing all the I/O pins into the module or modifying the original code every time, both of which I wanted to avoid.

My answer was to use the Verilog `include directive inside the boilerplate. That way your code has access to everything the main module has, but you don’t have to change the main module. The only downside is that Quartus has a smart compile feature that can’t figure out when only an include file changes. So it wasn’t recompiling when I made changes. I turned that feature off in the Quartus options, so if you pick up my example project, you won’t have any problems.

Here’s my example user.v:

reg [27:0] hadcounter;
assign bMKR_D[6]=bMKR_D[5]?hadcounter[27]:hadcounter[21];

always @(posedge wOSC_CLK)
begin
   if (!rRESETCNT[5])
   begin
      hadcounter<=28'hfffffff;
   end
   else
   begin
      if (hadcounter==28'h0) hadcounter<=28'hffffffff; else hadcounter<=hadcounter-28'h1;
   end
end

In the real file, I left a lot of comments in that explains what all the main module has that you can use. But the above is the working part. I define a 28 bit counter. The bMKR_D array is the digital ports for the Arduino and I’m using pin 6 and 5 as an output and an input, respectively.

The assign statement says, in English, If D5 is high, connect the 27th bit of the counter to the LED. If it is low, connect the 21st bit. The rest of the code just makes the counter countdown. I reload the counter even though it would naturally roll over in case you want to fine tune it to a different frequency.

As the counter runs, bit 27 will toggle relatively slowly, but bit 21 will be a good bit faster — that’s just how a counter is. So by changing D5 you can make the LED blink slow or fast.

As Verilog goes, this isn’t very complicated or even useful, but it is simple and shows that we can share data with the CPU in both directions. If you open the example project in Quartus, all you really need to do is make any changes to user.v you like, add any other files you want to use and double-click the Compile Design task (see left). If you get a successful compile, you’ll find the ttf file in the output_files directory. That’s the file you need to process with either the Java program, the C program, or the awk script. Either way, collect the output as app.h and put it in the same directory as your Arduino code.

CPU Side

On the sketch side, you need to leave the template code alone since it turns on the FPGA clock, among other things. You’ll notice it also includes app.h and uses a file called jtag.c to communicate with the FPGA. I didn’t segregate the Arduino code into its own include because you probably have to change the setup function, and make changes in global space, but that could be arranged (perhaps make setup call cpu_setup and loop call cpu_loop or something).

If you want to remove the demo parts of the blink-sketch file, you can get rid of:

  • The definitions and calls related to FPGAVal, SPEED, and FPGALED
  • The Serial calls and definitions
  • Everything in the loop function

I left the unmodified code in the EmptySketch directory. Note in the demo code, though that SPEED is an output. This is set to D5, which is an input to the FPGA. By the same token, FPGALED corresponds to D6 and allows the CPU to read the state of the LED output.

You will need an LED and dropping resistor on pin 6 unless you want to watch with a scope or a meter. I always keep some LEDs with built-in 5V dropping resistors handy, and even at 3.3V it was plenty bright. With one of those, you can just stick the wires right into the header socket on the board. Don’t try that with a regular LED, though!

Once you run the sketch, you can open the serial monitor or any terminal at 9600 baud. There will be a message saying you can press any key to change the blink rate. Of course, since the serial monitor doesn’t allow you to press keys exactly, you’ll have to enter something and hit enter (set “No line ending” at the bottom of the monitor screen), but on a real terminal, any character press should do it.

The main code is pretty simple:

void loop() {
static int oldstate=-1;
static int linect=0;
int state;
if (Serial.read()!=-1)
  {
  FPGAVal=FPGAVal==HIGH?LOW:HIGH;
  digitalWrite(SPEED,FPGAVal);
  }
state=digitalRead(FPGALED);
if (state!=oldstate)
  {
  Serial.print(state);
  if (++linect==16)
    {
    Serial.println();
    linect=0;
    }
  oldstate=state;
  }
}

In the loop, if serial data appears, we just toggle the output going to the FPGA. We also sample the LED output on every pass. If it has changed from the last time, we write the new state to the terminal and then update the state so we don’t flood the screen with repeated characters. A lot of the code is just tracking when we’ve written enough to start a new line.

Vidor’s Hello World

I wanted to get everything you needed in one place and an example that would be easy to follow yet show the critical working parts. It would be easy enough to use the shared I/O pins to do SPI, for example, and then you could trade data with the FPGA quite easily. Don’t forget there’s Arduino IP (intellectual property; sort of library subroutines for FPGAs) in the IP directory, too, if you want to use it.

Now you just need a project idea that makes sense for an FPGA. Our personal favorite would be a logic analyzer. The CPU can talk to the PC, set up triggers and then let the FPGA do the dirty work of finding the trigger and storing data as fast as possible. If you want something less ambitious, it is very simple to create totally autonomous PWM outputs on an FPGA. We could see this being handy for robotics or machine control where you want a very rapid sequence of outputs without CPU intervention or overhead.

Of course, not every project has to make sense. If you are just wanting to learn about FPGAs there are plenty of projects you could do with a CPU but are easy enough to build in an FPGA (the classic traffic light comes to mind). Of course, with the Vidor you have an opportunity to use a blend of FPGA code and CPU code, which is kind of the point.

vintageSynt

Electronic musical instruments are fun for Makers. With some cheap tools, know-how and passion, anyone can become a real synth geek. Just ask software developer Liam Lacey, who happens to also be a sound coder and freelance hacker. He recently won element14’s Open Source Music Tech design challenge for his Vintage Toy Synthesizer project — it’s an acoustic wooden toy piano converted into an open-source, standalone polyphonic digital synthesizer running on a BeagleBone Black and an Arduino Pro Mini.

Playing an instrument is about a lot more than just the sound you create – the way you play it; the physical feedback; and the overall feel and aesthetics of the instrument also play a big role in the overall experience, with these elements also helping to nurture inspiration, and can even affect your perception of the sound created.

Lacey developed the voice engine using the C++ audio DSP library Maximilian, and the keyboard mechanism uses homemade pressure sensors made out of Velostat. The instrument has 18 keys, though players able to alter scales using the knobs on top of the mini piano’s lid. Other dials are used to toggle dedicated waveform oscillators, filters and onboard distortion effects, and there’s even vintage parameters for replicating old or broken analog synth voices. What’s neat is that the converted toy can also act as a MIDI controller to send velocity-sensitive note messages and polyphonic aftertouch to Logic Pro, Ableton Live and various music software programs.

Here’s a diagram of the software architecture of the synth:

software_architecture_diagram

You can read more about the hack here, as well as listen to some quick and rough sound/patch demos:

The project took three and a half months to bring to fruition, and let us just say, the final result is quite impressive! Check out the video below to learn more about its specs and explore the complete documentation on GitHub.

 

Even the most die-hard Arduino fan boys have to admit that the Arduino development environment isn’t the world’s greatest text editor (they’d probably argue that its simplicity is its strength, but let’s ignore that for now). If you are used to using a real code editor, you’ll probably switch to doing your Arduino coding in that and then use the external editor integration in the IDE.

That works pretty well, but there are other options. One we noticed, PlatformIO, extends GitHub’s Atom editor. That makes it cross-platform, powerful, and with plenty of custom plug ins. It also supports a range of platforms including Arduino, many ARM platforms, MSP430, and even desktop computers running Linux or Windows.

The author claims the plug in will generate code for over 200 embedded boards. It handles all the common development tasks and even includes a terminal window. There are command line tools if you want to build scripts or make files and bypass the GUI.

You can install Platform.io on Windows, Linux, or Mac. It uses Python, so porting it elsewhere might be easy, too. The feature list is broad: code completion, linting, multiple projects, and library management. It can even import projects from the Arduino IDE. There are plenty of plug ins to add features (like Emacs keybindings, although that took a little troubleshooting).

There is also something attractive about having a single IDE that targets different platforms if you switch back and forth a lot. In all fairness, the Arduino IDE isn’t as bad as it used to be, and they both have significantly improved versions in the works (Arduino Create and Arduino Studio). We’ve seen plenty of other IDE hacks for Arudino in the past.

Thanks for the tip [Martin]


Filed under: Arduino Hacks

Screenshot 2015-11-03 12.27.18

Today we are very proud to release Arduino IDE 1.6.6 and updated cores for all supported platforms (AVR 1.6.9, SAM 1.6.5, SAMD 1.6.2)

This update brings an impressive 723 closed issues and 147 pull requests merged.

Most intriguing features are:

  • Long-awaited new arduino-builder: this is a pure command-line tool which takes care of mangling the code, resolving library dependencies and setting up the compilation units. It can also be used as a standalone program in a continuous-integration environment
  • Pluggable USB core: your Arduino can finally act as a lot of different USB devices without any need to change the core, thanks to the new modular architecture. Libraries based on the new subsystem are already being developed!
  • Serial plotter: you can now plot your data in realtime, as easy as writing Serial.println(analogRead(A0)) inside your loop

serial_plotter_with_ide

 

(altro…)

Mag
10

Embroidered Nyan Cat Brings a Meme to the Real World

adafruit, arduino, arduino hacks, audio, audiofx, cat, embroidery, Github, LED, meme, nyan, nyan cat, Sewing Commenti disabilitati su Embroidered Nyan Cat Brings a Meme to the Real World 

Have you ever come across an Internet meme and just thought to yourself, “I have to bring this into the physical world!” Well [0xb3nn] and [Knit Knit] did. They decided to take the classic nyan cat meme and bring it to life.

The frame is 24″ x 36″. Many hours went into the knitting process, but the result obviously turned out very well. The stars include 24 LED sequins to add a sparkling animation effect. These were sewn onto the back of the work using conductive thread. They are bright enough to shine through to the front where needed. These connect back to an Arduino Pro Mini 5V board.

The Arduino is also connected to a capacitive touch sensor. This allows the user to simply place their hand over the nyan cat image to start the animation. No need for physical buttons or switches to take away from the visual design. An Adafruit AudioFX sound board was used to play back a saved nyan cat theme song over a couple of speakers. The source code for this project is available on github. Be sure to watch the demo video below.


Filed under: Arduino Hacks


  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook