Showing posts with label library. Show all posts
Showing posts with label library. Show all posts

14 April 2015

The DMX library DMXSerial for Arduino is now available using the Arduino Library Manager

From now on it’s easy to install and update the library by using the Library Manager in the Arduino environment including including 3 sample applications for sending and receiving DMX messages.

I used several of the beta versions and also the final to test compatibility of my DMXSerial library.

By using the Library Manager you can always download the latest stable version that is tagged with the version number directly in my github repository.

You can find that repository directly at:

If you haven’t already done so, please download the new Arduino environment version 1.6.3 or later from the Arduino web site www.arduino.cc.

 

If you like the latest version including work in progress please use the download from github directly by using a git or subversion client. If you like to contribute I like to see your attributions based on this version.

28 October 2014

An Arduino library for FM radio chips

My latest project is about controlling an FM radio chip by using an Arduino Board, an LCD display and a rotary encoder all the components I need to build a standalone radio for my needs.

There are diverse radio chips available for building radio receivers. Because most of them are made for integration into mobile phones or car radios they normally come on breakout boards, sometimes together with audio amplifiers for headphones.

The ones I found and tried are:

  • The SI4703 from Silicon Labs
  • RDA5807 from RDA Microelectronics
  • TEA5767 from NXP

    They all are capable for receiving FM radio stations in stereo with European and US settings and can be controlled by using the I2C bus. However there are differences in the sensitivity and quality and well on receiving RDS information from the stations.

    The idea of the project beside implementing a radio for my personal needs is to provide Arduino compatible libraries for these (and possible more) chips that all offer the same functionality and expose the same functions. These radio chip adaptions can be combined with the also available RDS encoder and the radio applications.

    This is my current hardware setup for the latest project I am working on by using a breakout board for the SI4703 chip including an audio amplifier that I found on eBay:

    SAM_2504

    The radio library

    The libraries for this project can be found on github:

    https://github.com/mathertel/Radio

    You can download all the files at once by using the provided zip file:

    https://github.com/mathertel/Radio/archive/master.zip

    I still work on this and still some features I like to implement are still in development but maybe you already have experiences with audio functionality on the Arduino or other platforms or you also work on a similar project. Let me know (via eMail) and maybe we can share some experiences.

    Open Topics

    • Implementing all functions for all chips
    • good documentation
    • pictures
    • writing about using LCD displays in the I2C bus
    • writing about interpreting RDS data
    • … let me know
  • 14 December 2013

    Arduino DMX libraries now also available on Github

     

    In the last weeks I got some very valuable feedback and some corrections for the DMXSerial2 library for Arduino from Felicitus and he asked me to put the sources into the GitHub repository.

    I am used to work with Subversion and never worked with Git before but everything runs perfectly. I love the way how someone can add merge requests to an existing repository without the need to manage users and roles.

    So you can find the library now on:
    https://github.com/mathertel/DmxSerial2.

    You can download the complete library including the samples by using the “Download ZIP” button on the right-hand side or by using the link
    https://github.com/mathertel/DmxSerial2/archive/master.zip

    I plan to also leave a copy of the other Arduino libraries there.

    18 September 2013

    Update for DMXSerial2 the DMX RDM library for Arduino

    IT’s some months ago since I released the first version of DMXSerial2. Now there is an update with some fixes and some more complete functionality.

    First of all thanks to Simon Newton who shared the link to a copy of the RDM standard E1.20. A download is available at http://tsp.plasa.org/freestandards. “Now there are no more excuses for not complying with the standard” – he writes and I will try to do so.

    In the update you can the following additions:

    • The serial port definitions now also support Arduino MEGA 2560 (port 0 and 1) and Arduino Leonardo (port 1) boards.
    • I registered my own manufacurer id, now #0987 for mathertel.de.
    • There is a functionality that creates random device ids in the code. If a board once has started to work the device id will be stored into the eeprom and will remain there even when new software is uploaded.
    • I added the required RDM parameters SOFTWARE_VERSION_LABEL and SUPPORTED_PARAMETERS to comply with the standard.
    • Finally I removed some DMX-only specific code and did some simplifications and memory optimizations.
    • The initialization data for the library is now combined into a new structure.

    It was an easy job to register a manufacturer id to myself as explained on http://tsp.plasa.org/tsp/working_groups/CP/mfctrIDs.php. Feel free to use my manufacturer id yourself if you promise only to use it for experiments and never to put a real device that leaves your hands.
    If you plan for more please request your own manufacturer id and adjust the _devID definition to use it.

    You can find the new version of the library now on http://www.mathertel.de/Arduino/DMXSerial2.aspx.

    I will update the text of this site in the next days.

    31 August 2013

    DMXBridge, a wireless DMX sender and receiver

    There are situations where DMX cables are unwanted or just not practical. This project implements a wireless transfer of a DMX signal in the 2.4 GHz band using the Arduino platform and the popular transceiver module nRF24L01+ from nordic semiconductor.

    The DMX protocol

    Receiving and sending the DMX protocol from the ATmega chip is done by using the DMXSerial library and the built-in serial port. This implementation is using interrupts and is a good base for implementing a second protocol on the same chip.

    The DMX Serial library has a built-in 512 byte buffer for a DMX universe that is accessible using the functions provided by the library. After initializing the library and starting the communication the interrupts ensure the communication in the background.

    You can find a lot of details in the article about the DMXSerial library.

    The Wireless protocol

    The 2.4GHz RF Transceiver is connected to the Arduino board or ATmega processor by using the SPI interface. The library for driving this chip I used is the library from Greg Copeland that you can find at https://github.com/gcopeland/RF24. After initializing the library it is possible to send and receive data by using the provided functions of the library. The library transfers all the commands and data to the nRF24L01+ chip will also handle all the transfer details in the background.

    Implementation

    Because the libraries handle most of the communication details the implementation of this project only has to close the gap between the 2 protocols. The main differences between them are

    Frame size: DMX is using a max. 512 byte long frame for sending all the values of all channels at once. The Transceiver uses a much shorter protocol that can transfer up to 32 bytes in one frame. I have seen controllers that do not send all the 512 bytes when only some channels are used in the setup.

    Transfer speed: DMX is constantly using a 250 kBaud serial transfer speed on the DMX wire. There may be longer gaps between the frames and also between the individual bytes of a frame but it is common to use the maximum possible transfer speed. The Transceiver is supporting 3 different transfer modes

    The solution I found and implemented here is to break up the 512 channels of the DMX information into smaller packages.

    The sender

    There are 2 buffers of DMX values. One contains the values I have received lately from the DMX protocol. The DMXSerial library is used to listen to the DMX protocol and fill this buffer.

    The second buffer contains the values that have been sent over the wireless.

    The values of both buffers are compared to find the recent changes and to send them with priority. If there is no difference between the 2 buffers no priority data will be sent.

    To enable the addition of new receivers and to heal dropped packages all the DMX data is sent from time to time regardless whether there are changes on not.

    The package transferred wirelessly contains a start-address and the actual 8 values starting at this address. The sender just sends the package without requesting any handshake from the receiver. This is called the broadcast mode of the nRF24L01+ modules that enables to use multiple receivers.

    The receivers

    The receiver only needs a single DMX buffer. All data from the incoming packages is directly taken into this buffer.

    The DMXSerial library is used to send this information using the DMX protocol.

    Setup the hardware

    Both, the sender and the receivers need the DMX interface hardware attached to the serial interface and a nRF24L01+ module attached to the SPI bus. A prototype for this setup I used is the DMX Shield I published and a hand-soldered nRF24L01 adapter. The DMX shield is not forwarding the ICSP pins yet so this will only work on the Arduino UNO and older boards. (See discussion in Arduino Shield for NRF24L01+ post).

    You need 2 of these at minimum.

    Setup the software

    Now you should be able to open and compile the provided sketches and upload them to the Arduino hardware.

    The sketches I can provide for now are working in my environment and are not yet optimal for rough environments like stages. There are still some optimizations to do like sending smaller or larger packages and testing different transfer speeds. I like to get feedback from you.

    Links

    26 August 2013

    DMXSerial Update

    I just updated the Arduino Library for DMX with some improvements in memory and speed as well as some minor changes.

    Thanks to Jenny for the hints.

    If you use this library please download the newest version from: http://www.mathertel.de/Arduino/DMXSerial.aspx

    19 May 2013

    Update for the DMXSerial library

    There is a significant update for the DMXSerial library on my web site that enables programming DMX devices on ARDUINO MEGA boards and ARDUINO Leonardo boards using the DMXSerial library.

    The original library was written for Arduino 2009 and Arduino UNO boards that use the ATmega328 or ATmega168 chip. These chips only have a single Universal Synchronous and Asynchronous serial Receiver and Transmitter (USART) a.k.a. the Serial port in the Arduino environment. The DMXSerial library uses this port for sending or receiving DMX signals.

    This conflicts a little bit with the usage of the programming mode the Arduino offers through then USB ports or serial interfaces but it is possible to build compatible DMX shields that don’t interfere with this usage if done right. The DMXShield is an example of this.

    Arduino Leonardo

    The Arduino Leonardo board uses a chip that has a USB 2.0 port available in addition to the USART. Therefore the “Serial” port is routed through the USB port that behaves like a serial port device and not the built-in USART. If you like to address the real Serial port you have to go with the Serial1.

    But if you look at the hardware and the registers directly the USART0 still exists but the definitions for addressing the registers have changed (for example USART_RX_vect is now USART0_RX_vect). Therefore some adjustments had to be done.

    With this board you can write debugging information to the Serial port in your sketch for debugging or data exchange purpose. So maybe a DMX diagnostic sketch can profit from that.

    Arduino MEGA 2560

    When using the chip on the Arduino MEGA 2560 board you have more than one USART available and maybe you wish to use port 1 instead of port 0. This can be done by enabling the definitions for port1 in the library just uncomment the line

    #define DMX_USE_PORT1

    ATmega8 boards

    I added the definitions of boards based on the ATmega8 too for experimental purpose. If you find problems with these boards, leave me a note please.

    Thanks to Bob Lynas to support me.

    Available

    The updated version is available on my site at: http://www.mathertel.de/Arduino/DMXSerial.aspx.

    14 April 2013

    Hints on using NRF24L01+ with Arduino

    I like to share some liks to the ressources on the internet that I found helpful for implementing projects using the Ultra low power 2.4GHz RF Transceiver NRF24L01+ with the Arduino platform.

    The chip specifications

    The NRF24L01 (no + at the end) was replaced by the NRF24L01+ (or sometimes called NRF24L01P). Be sure to get the new chip when buying an breakout board.

    The nRF24L01+ is drop-in compatible with nRF24L01 and on-air compatible with nRF2401A, nRF2402, nRF24E1 and nRF24E2. Intermodulation and wideband blocking values in nRF24L01+ are much improved in comparison to the nRF24L01 and the addition of internal filtering to nRF24L01+ has improved the margins for meeting RF regulatory standards.

    The old chip: http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRF24L01

    The new chip: http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRF24L01P

    You should read the nRF24L01+DataSheet, even if it is long and with many details – but that’s what you will need: http://www.nordicsemi.com/eng/content/download/2726/34069/file/nRF24L01P_Product_Specification_1_0.pdf

    About ShockBurstTM

    This is a nice to read whitepaper with a description of the ShockBurstTM transfer features of the chip:

    http://www.semiconductorstore.com/pdf/NewSite/nordic/WP_nRF240x_ShockBurst.pdf

    Arduino compatible Libraries for NRF24L01

    There is no official “Arduino” library that is maintained by the core Arduino team so you have to look for the available libraries on the internet.

    The  web site http://www.tinkerer.eu/ from Stefan Engelke in 2009 provides a native NRF20L01 library, the original MiRF library (not Arduino specific) and a native SPI library See http://www.tinkerer.eu/AVRLib/nRF24L01, and http://www.tinkerer.eu/AVRLib/SPI . I mention this library because it uses interrupts that most Arduino samples don’t.

    The MiRF library was ported to the Arduino platform and is using the Arduino SPI library and is described on the arduino playground article: See http://playground.arduino.cc/InterfacingWithHardware/Nrf24L01

    J. Coliz (a.k.a. maniacbug) implemented a ARDUINO specific library often called the RF24 library. Its available at https://github.com/maniacbug/RF24/ and was used as the base for implementing other libraries (see below) the last commit to this projects was last on 2012/06/23.

    Greg Copeland forked (copied over) the library from maniacbug and added some useful stuff including a scanner sample application. He is currently (2013.04.09) supporting his work. See https://github.com/gcopeland/RF24.

    Arco van Geest (a.k.a. gnulnulf) also forked the library from maniacbug is currently adding support for the Raspberry Pi. See https://github.com/gnulnulf/RF24

    Stanley Seow forked the version gnulnulf https://github.com/stanleyseow/RF24 also working on upport for the Raspberry Pi.

    Critics

    There are too much libraries out there for my opinion and those starting from J. Coliz are using the GNU General Public License (not LGPL) and therefore are not compatible with the Arduino license policy.

    J. Coliz also used the stdio.h printf() functionality ??? causing more usage of the program memory

    For my personal projects I used the library from Greg Copeland for my first steps to discover the functionality of the chip.

     

     

     

    Samples and Projects

    Poor Man's 2.4 GHz Scanner:
    http://arduino.cc/forum/index.php/topic,54795.0.html

    Home Automation – Designing a remote module:
    http://geekboy.it/projects/home_automation/home-automation-design

    Sample without using a library:
    http://blog.iteadstudio.com/nrf24l01-wireless-module-with-arduino/

    A sample using the MiRF library:
    http://www.bajdi.com/playing-with-nrf24l01-modules/

    Step-by-Step introduction using the RF24 library:
    http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo

    Network Layer for RF24 Radios:
    http://maniacbug.github.io/RF24Network/index.html

    A very detailed tutorial in German:
    http://www.mikrocontroller.net/articles/NRF24L01_Tutorial

    Other Stuff

    These links are not related to Arduino itself but when reading you may also find some interesting information.

    ...

    07 April 2013

    Update to the OneButton Arduino library

    I wrote this small Arduino library more than 2 years ago for some of my projects to use a single input button for multiple purposes. This library detects clicks, doubleclicks and long press situations without a lot of coding on the sketch side.

    This enables you to reuse the same hardware button and input pin for several functions and lowers the hardware invests.

    I just updated it including a new sample that shows how to setup the library and bind a "machine" that can blink the LED slow or fast.

    See Arduino OneButton Library on my side.