Posts | Comments

Planet Arduino

Archive for the ‘Library’ Category

Strobe Remote

If you want to take a photograph with a professional look, proper lighting is going to be critical. [Richard] has been using a commercial lighting solution in his studio. His Lencarta UltraPro 300 studio strobes provide adequate lighting and also have the ability to have various settings adjusted remotely. A single remote can control different lights setting each to its own parameters. [Richard] likes to automate as much as possible in his studio, so he thought that maybe he would be able to reverse engineer the remote control so he can more easily control his lighting.

[Richard] started by opening up the remote and taking a look at the radio circuitry. He discovered the circuit uses a nRF24L01+ chip. He had previously picked up a couple of these on eBay, so his first thought was to just promiscuously snoop on the communications over the air. Unfortunately the chips can only listen in on up to six addresses at a time, and with a 40-bit address, this approach may have taken a while.

Not one to give up easily, [Richard] chose a new method of attack. First, he knew that the radio chip communicates to a master microcontroller via SPI. Second, he knew that the radio chip had no built-in memory. Therefore, the microcontroller must save the address in its own memory and then send it to the radio chip via the SPI bus. [Richard] figured if he could snoop on the SPI bus, he could find the address of the remote. With that information, he would be able to build another radio circuit to listen in over the air.

Using an Open Logic Sniffer, [Richard] was able to capture some of the SPI communications. Then, using the datasheet as a reference, he was able to isolate the communications that stored information int the radio chip’s address register. This same technique was used to decipher the radio channel. There was a bit more trial and error involved, as [Richard] later discovered that there were a few other important registers. He also discovered that the remote changed the address when actually transmitting data, so he had to update his receiver code to reflect this.

The receiver was built using another nRF24L01+ chip and an Arduino. Once the address and other registers were configured properly, [Richard's] custom radio was able to pick up the radio commands being sent from the lighting remote. All [Richard] had to do at this point was press each button and record the communications data which resulted. The Arduino code for the receiver is available on the project page.

[Richard] took it an extra step and wrote his own library to talk to the flashes. He has made his library available on github for anyone who is interested.

Filed under: Arduino Hacks, radio hacks

Arduino SPI Library Gains Transaction Support

arduino, arduino hacks, interrupts, jitter, Library, SPI Commenti disabilitati su Arduino SPI Library Gains Transaction Support 

Transaction SPI Timing

Transaction SPI Timing

To prevent data corruption when using multiple SPI devices on the same bus, care must be taken to ensure that they are only accessed from within the main loop, or from the interrupt routine, never both. Data corruption can happen when one device is chip selected in the main loop, and then during that transfer an interrupt occurs, chip selecting another device. The original device now gets incorrect data.

For the last several weeks, [Paul] has been working on a new Arduino SPI library, to solve these types of conflicts. In the above scenario, the new library will generate a blocking SPI transaction, thus allowing the first main loop SPI transfer to complete, before attempting the second transfer. This is illustrated in the picture above, the blue trace rising edge is when the interrupt occurred, during the green trace chip select. The best part, it only affects SPI, your other interrupts will still happen on time. No servo jitter!

This is just one of the new library features, check out the link above for the rest. [Paul] sums it up best: “protects your SPI access from other interrupt-based libraries, and guarantees correct setting while you use the SPI bus”.

Filed under: Arduino Hacks

Decoding Weather Radio messages with Arduino

arduino, Library, radio, weather Commenti disabilitati su Decoding Weather Radio messages with Arduino 


Arduino user Vogel1230 wrote us:

I’ve been involved with NOAA Weather Radio for some time and Arduino is a recent passion of mine over the last couple of years. When I found out about the Silicon Labs Si4707 Weather Band IC, it only made sense that I try to use my hardware knowledge and try and come up with a breakout board to make this capability available to the public.

I teamed up with Ray Dees who had done a lot of work with decoding weather radio messages using a different architecture. After a few months of collaboration on software we were able to build a very strong library that enables even the beginner to use all the features of the iC and modify as they see fit for their application. The code is currently optimized for UNO and Mega2560 use.



HSB RGB Arduino Color Library

arduino, Library, RGB Commenti disabilitati su HSB RGB Arduino Color Library 


This code show a basic example of using the color library to make a rainbow appear on RGB LEDs. By varying the hue the rainbow function moves across the whole visible color spectrum.

HSB RGB Arduino Color Library – [Link]



The purpose of this article is to demonstrate the use of the second (here’s the first) interesting LED display module I discovered on the dealextreme website, for example:

As you can see the display unit holds a total of sixteen seven-segment LED digits using four modules. However thanks to the use of the TM1640 controller IC

… the entire display is controlled with only four wires – 5V, GND, data in and clock:

Here is the data sheet for the TM1640. The board also ships with the 30cm long four-wire lead and fitted plug. Finally, there is a ‘power on’ LED on the right-hand end of the board:

Getting Started

Now to make things happen. From a hardware perspective – it couldn’t be easier. Connect the 5V and GND leads to … 5V and GND. The data and clock leads will connect to two Arduino digital pins. That’s it. The maximum current drawn by the display with all segments on is ~213mA:

So you should be able to drive this from a normal Arduino-compatible board without any hassle. Please note that the TM1640 IC does heat up somewhat, so you may want to consider some sort of heatsink if intending to max out the display in this manner.

From the software side of things you will need to download and install the TM1638 library (yes) which also handles the TM1640 chip. To simply display text from a string on the display, examine the following sketch:

Which will display:

The sixteen digit binary number in the module.setDisplayToString() line controls the decimal points – 0 for off and 1 for on. For example, changing it to

will display:

You can also display text in a somewhat readable form – using the characters available in this list. Displaying numbers is very easy, you can address each digit individually using:

where x is the digit, y is the position (0~15), and true/false is the decimal point. At this time you can’t just send a long integer down to the display, so you will need to either convert your numbers to a string or failing that, split it up into digits and display them one at a time.

In the following example sketch we display integers and unsigned integers by using the C command sprintf(). Note the use of %i to include an integer, and %u for unsigned integer:

And the resulting output:

Now you have an idea of what is possible, a variety of display options should spring to mind. For example:

Again, this display board was a random, successful find. When ordering from dealextreme, do so knowing that your order may take several weeks to arrive as they are not the fastest of online retailers; and your order may be coming from mainland China which can slow things down somewhat. Otherwise the module worked well and considering the minimal I/O and code requirements, is a very good deal.

Have fun and keep checking into Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

The post Arduino and TM1640 LED Display Modules appeared first on tronixstuff.

  • 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