Recurring Neural Network

Two days ago I found this nice post at Hackaday about a guy who create a program to generate music:

Neural Network Composes Music; Says “I’ll be Bach”

He used Long Short Term Memory networks (LSTM) a kind of Recurring Neural Network (RNN), then I started to search more about these subjects and found some interesting links that I want to share with you:

Understanding LSTM Networks:
http://colah.github.io/posts/2015-08-Understanding-LSTMs/

The Unreasonable Effectiveness of Recurrent Neural Networks:
http://karpathy.github.io/2015/05/21/rnn-effectiveness/

Recurrent Neural Networks Tutorial:
http://www.wildml.com/2015/09/recurrent-neural-networks-tutorial-part-1-introduction-to-rnns/

I hope you enjoy reading about it. When I got something about it working on microcontrollers I will post here.

Tips: SD Card Detection on NuttX

Today I got SDCard over SPI working on NuttX and already submitted the patch to mainline: https://bitbucket.org/nuttx/nuttx/commits/adb32e31a0123a16095f53de0c2b493b7db11281

Now you also can test SDCard using the STM32F103-Minimum board.

This post is to explain how NuttX’s SDCard driver does to ignore the Card Detect pin on modules that doesn’t have it. Yes, my module doesn’t have CD pin, see:

Initially I was getting this warning message:

WARNING: No card present

And when I tried to mount the SDCard it reported error -19. Well, error -19 is “ENODEV”, that means: “No such device”.

Then analyzing the source code of the driver (at nuttx/drivers/mmcsd/mmcsd_spi.c) I found this:

  /* Check if there is a card present in the slot.  This is normally a matter is
   * of GPIO sensing and does not really involve SPI, but by putting this
   * functionality in the SPI interface, we encapsulate the SPI MMC/SD
   * interface
   */

  if ((SPI_STATUS(spi, SPIDEV_MMCSD) & SPI_STATUS_PRESENT) == 0)
    {
      fwarn("WARNING: No card present\n");
      slot->state |= MMCSD_SLOTSTATUS_NODISK;
      return -ENODEV;
    }

Hmm, interesting! NuttX can use the return of spi_status() function to inform that card is present. Interesting, I was going to mess with the card detection thread/callback, saved by the bell!

Then all I did was to include:

#ifdef CONFIG_MMCSD_SPI
  if (devid == SPIDEV_MMCSD)
    {
       status |= SPI_STATUS_PRESENT;
    }
#endif

inside the stm32_spi1status() at nuttx/configs/stm32f103-minimum/src/stm32_spi.c!

This is a simple and clever solution, like everything else in the NuttX!

Compiling the Circuit Simulator kTechLab

I was searching for a circuit simulator for Linux and found kTechLab.

There is not a built package for Ubuntu (I’m using Ubuntu 16.04) then I compiled it from source code:

$ git clone https://github.com/ktechlab/ktechlab
$ cd ktechlab/
$ sudo apt-get install libqt4-dev
$ sudo apt-get install kdelibs5-dev
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install

Then I just execute:

$ ktechlab

And kTechLab starts in all its glory!

How to get the machine origin with LINUXCNC

Today I tested the LinuxCNC controlling all 3 stepper motors (one for each axis) connected on TB6560-4V3 board.

Everything worked as expected, but zeroing the HOME axes manually is very boring. Then I decided to search how to do it automatically.

I found this nice post exampling the process:

http://o3ozono.com/en/como-conseguir-el-origen-maquina-con-linuxcnc/

I will need to connect the switches limiters (end-stoppers) to my CNC first to get it working. BTW I decided to post about it with the link to original post because it could be useful for other people.

CNC: Wire Limit Switches

I’m finishing my CNC building and now I need to wire the Limit Switches (End-stops).

My CNC initially will be controlled by TB6560-4V3 board, then searching for more information about how to connect the end-stops I found this nice tutorial:

http://www.hobbycncaustralia.com/Instructions/iI19wirelimit.htm

Their TB6560 board is a little-bit different from mine (they are using older model), but almost all (if not all) information could be applied to my board as well.

So, let me go ahead and stops these motors at its end!