Category Archives: Electronics

Open Bionics robotic hand for amputees

“A prototype 3D-printed robotic hand that can be made faster and more cheaply than current alternatives is this year’s UK winner of the James Dyson Award.” (BBC News link)

This is a fantastic idea, which has so much value to people without limbs. Bionic prosthetics can cost up to £100,000, and £30,000 for a single hand.

The 3D-printed robotic hand in the article costs £2,000, which is the same price as a prosthetic hook, and offers similar functionality to the top-of-the-range options.

The designer gets to develop his interest in creating a product, while helping the estimated 11 million people who are hand amputees worldwide.

Open Bionics

Using a Cellular/Mobile Phone Network to Send Data with Arduino/Embedded

Today I used an Arduino reprogrammable electronics board and a GSM/GPRS modem to send data to the Internet. This will be useful for the sensors I intend to build.

You can see a video of it operating below. One window shows the output from the serial interface as it makes a request to my web server and outputs the response, and the other window displays the access logs on my web server.

I used a software UART (parallel and serial data converter), as using the Arduino’s built-in serial interface caused conflicts. Learning to use a software UART is going to be very useful for the next step in the project.

I did consider making a Cat Facts for Arduino, but I resisted the distraction.

I didn’t have any issues with power spikes causing a reset (the GSM board uses a lot of power) as this is a version 2 board with soft start circuitry:

Soft Start Circuitry
Soft Start Circuitry (Source)

I also used AT codes to send SMS text messages. A full list of AT codes are available here, and I used these:

Send a text

Set to human readable text mode:
AT+CMGF=1

Set phone number:
AT+CMGS=”447944581307″

Enter the message

Send hex 1A to escape message.

List texts

AT+CMGL

Read a text

AT+CMGR=<index> (indexes start at 1)

Delete a text

AT+CMGD=<index>

 

The only stumbling point I had was when the GSM modem was set to a different baud rate than my software serial interface. To change this, I sent the AT command AT+IPR=9600 to reconfigure the modem.

I learnt that AT commands are also used to send and receive via TCP/UDP. This made it much more straightforward than some kind of low level system I had imagined. All that is required from the Arduino is to send AT commands (e.g. AT+CIPSEND=) and listen for incoming responses.

Explanation for non-techies:

I made an electronic circuit that can send information to the Internet. This will be useful for making a sensor e.g. a temperature sensor for an office that is accessible on any computer/smartphone.

Arduino for Atmel Studio

Atmel Studio now has an extension designed as a simple alternative to the Arduino IDE.

The Arduino IDE is relatively simple. It is great to get started with AVR programming, and has some useful examples to get you started, but lacks many of the features that experienced programmers call for like detailed compiler warnings, debugging capabilities, auto-completion and unit testing.

Arduino IDE
Arduino IDE

Programming for AVR at a lower level in Atmel Studio can also have performance improvements. Shifting bits rather than using Arduino IDE’s ‘digitalwrite’ can have a 10x speed improvement for example.

Atmel Studio supports a wider range of AVR microchips. This can be useful if you aim to program one of Atmel’s huge range of microchips. I have a ATtiny13A, which uses considerably less power than the ATMega328 in my Arduino board (190 µA in active mode, and 24 µA vs. 0.2 mA in active mode, 0.1 µA in power-down mode, and 0.75 µA in power-save mode).

Atmel Studio

So if you feel you are outgrowing the Arduino IDE, give Atmel Studio a try. You may find this tutorial useful: Using Atmel Studio 6 with Arduino projects, or How to Setup Atmel Studio for Arduino Development.

Simplicity can be more important though, and the Arduino IDE may be more suitable for your application. After all, projects are generally relatively simple when you have less than 16 KB of memory to play with. I expect I will continue using the Arduino IDE primarily, and Atmel Studio for any particularly challenging projects.

Simple explanation for non-techies

Arduino refers to a few types of tiny electronic board with a reprogrammable microchip. Programs can be sent from a computer to this microchip to perform whatever task is required.

A fun example is Leah Buechley‘s Turn Signal Biking Jacket project, shown in the video below:

Software Defined Radio (SDR) and Field-Programmable Gate Arrays (FPGA) – A Free Radio Scanner

When I was growing up, one of my favourite birthday presents was a Uniden UBC3000XLT radio scanner. I enjoyed finding and listening to various radio transmissions, and I had some success decoding data transmissions and morse code using my PC and Sound Blaster soundcard.

Uniden UBC-3000XLT Radio Scanner
Uniden UBC-3000XLT Radio Scanner

I was interested to read about a technique called Software Defined Radio (SDR), which can sample the entire shortwave spectrum, and use the processing power of a computer to virtually ‘tune’ in to transmissions.

A home-built SDR board operating at the University of Twente in the Netherlands (pictured below) and a receiving element around 5cm x 10cm is capable of receiving a frequency range of 0 – 29.160 MHz.

It uses a Spartan XC3S500E Field-Programmable Gate Array. FPGAs can be programmed using a hardware description language, and arrays of programmable logic blocks which can be virtually inter-wired. The most important advantage over a microcontroller like a Atmel/Arduino, is these operations can happen in parallel, which is critical to creating a software defined radio, as a typical AVR microprocessor simply doesn’t have the necessary clock speed. The sample rate must be at least twice the maximum frequency of the signal (Nyquist theorem).

PA3FWM Software Defined Radio
Software Defined Radio at the University of Twente

Taking this a step further, Software Defined Radio can allow multiple users to share the same receiver. At time of writing, 184 users are listening to different frequencies using the receiver at the University.

You can listen for yourself at the Wide-band WebSDR at University of Twente. It’s essentially a free radio scanner anyone can access for free. You might enjoy stumbling upon a variety of transmissions from all over the world, and you may have success using tools like Sorcerer to decode data transmissions, weather fax transmissions, and morse code.

With the ever-continuing advances in data storage capacities and scalable clouds, one day it may be a trivial matter to archive the entire radio frequency spectrum.

DIP switch with Arduino

Here is a useful function to read DIP switches with Arduino. Wire the switches to ground, as this uses pull-up resistors:

Photograph of a DIP switch

 

  1. int myDipPins[] = {2, 3, 4, 5, 6}; //DIP Switch Pins
  2. void setup()
  3. {
  4. Serial.begin(9600);
  5. for(int i = 0; i <= 4; i++)
  6. {
  7. pinMode(myDipPins[i], INPUT);       //Set DIP switch pins as inputs
  8. digitalWrite(myDipPins[i], HIGH); //Set pullup resistor on DIP switch pins
  9. }
  10. delay(100);
  11. }
  12. void loop()
  13. {
  14. byte DIPValue = readDIP(myDipPins, 5);
  15. Serial.print(DIPValue, BIN);
  16. Serial.print(“\n”);
  17. switch (DIPValue)
  18. {
  19. case B00000:
  20. Serial.print(“Match 00000\n”);
  21. break;
  22. case B00100:
  23. Serial.print(“Match 00100\n”);
  24. break;
  25. case B11011:
  26. Serial.print(“Match 11011\n”);
  27. break;
  28. case B11111:
  29. Serial.print(“Match 11111\n”);
  30. break;
  31. case B01001:
  32. Serial.print(“Match 01001\n”);
  33. break;
  34. case B10000:
  35. Serial.print(“Match 10000\n”);
  36. break;
  37. }
  38. delay(1000);
  39. }
  40. //Read binary from DIP switches
  41. byte readDIP(int* dipPins, int numPins)
  42. {
  43. byte j = 0;
  44. //byte j;
  45. //Get the switches state
  46. for(int i = 0; i < numPins; i++)
  47. {
  48. if (!digitalRead(dipPins[i]))
  49. {
  50. j += 1<<(numPins – 1 – i);
  51. }
  52. }
  53. return j; //Return result
  54. }

 

 

Be sure to check ” and ‘ symbols haven’t been made fancy by WordPress, or you’ll have errors in your code.