Introduction: HackerBoxes 0016: Cellular Metal

Picture of HackerBoxes 0016: Cellular Metal

CELLULAR METAL: This month, HackerBox Hackers are exploring cellular mobile communication for embedded IoT (Internet of Things) and M2M (Machine-to-Machine) systems. We are also exploring the beauty of working close to the bare metal of a computing machine.

This Instructable contains information for working with HackerBoxes #0016. If you would like to receive a box like this right to your mailbox each month, now is the time to subscribe at and join the revolution!

Topics and Learning Objectives for this HackerBox:

  • Compiling and Uploading Code onto an Arduino Board
  • Connecting a GSM Mobile Radio Module to an Arduino
  • Communicating on a Global Mobile Cellular Network
  • Building a Breadboard-Based Arduino from Scratch
  • Using an Existing Arduino as a DIY In-System-Programmer
  • Exploring an Online Microcontroller Course
  • Implementing a Minimal 8-Pin ATtiny Arduino
  • Dropping Down into Assembly and Machine Languages
  • Considering Machine Architecture through Assembly Language

HackerBoxes is the monthly subscription box service for DIY electronics and computer technology. We are hobbyists, makers, and experimenters. And we are the dreamers of dreams.

Step 1: HackerBoxes 0016: Box Contents

Picture of HackerBoxes 0016: Box Contents
  • HackerBoxes #0016 Collectable Reference Card
  • Hologram Global IoT/M2M SIM Card
  • SIM800L 5V GSM Module with Rubber Ducky Antenna
  • RobotDyn Arduino UNO R3 Microcontroller Board
  • CP2102 MicroUSB-Serial Module
  • Solderless Breadboard
  • 65 Piece Jumper Wire Set for Breadboard
  • ATmega328P 28-Pin DIP Microcontroller Chip
  • ATtiny85 8-Pin DIP Microcontroller Chip
  • Various Discrete Components for Breadboard Arduino
  • Various Discrete Components for Microcontroller Course
  • Exclusive Tux "Hack The Planet" Stress Toy
  • Exclusive Apple Hacker Fan Art Decal

Some other things that will be helpful:

  • Soldering iron and solder
  • Computer for running development tools

Most importantly, you will need a sense of adventure, DIY spirit, and hacker curiosity. Hardcore hobbyist electronics aren't always easy, but when you persist and enjoy the adventure, a great deal of satisfaction may be derived from persevering and getting your projects working. Just take each step slowly, mind the details, and don't hesitate to ask for help.

Step 2: Setting Up the Arduino UNO

Picture of Setting Up the Arduino UNO

Arduino Veteran:

If you are already up to speed with using an Arduino UNO, already have the Arduino IDE installed, and already have the CH340 USB driver installed, you can skip to the next step. However, you should probably at least plug in your UNO and make sure you can compile and upload an example (such as blink.ino) just to make sure everything is ready to go.

Less of a Veteran:

Check out Step 12 of the instructions for the HackerBoxes Starter Workshop. There, you will find an overview of the Arduino ecosystem, the RobotDyn UNO in particular, and most importantly details on installing the CH340 USB drivers.

Next, proceed to Step 13 of the instructions for the HackerBoxes Starter Workshop. There, you can grab a free copy of the Introduction to Arduino book by Alan Smith, Install the Arduino IDE, wire up your first Arduino circuit, and write your first Arduino program.

Optional Extra:

Continue on to Step 14 of the instructions for the HackerBoxes Starter Workshop to explore the world of Arduino even further. The components in this HackerBox #0016 happen to include everything needed to work through section 3.2 of the book. This is worth doing if you are new to Arduinos. You may also want to look at section 5.1 to learn about the serial monitor. While it is well beyond the scope of this current Instructable, the components for the remaining chapters list in Step 14 are included in the HackerBoxes Starter Workshop.

Step 3: Wire Up the SIM800L Module to the Arduino UNO

Picture of Wire Up the SIM800L Module to the Arduino UNO

Of course we've all had times when we would like to have a project communicate over the cellular communications network. Sometimes Wi-Fi is not available or just doesn't have enough range.

For example, maybe you want your project to send you a text message when a sensor is triggered. Or perhaps it needs to report data to another system from various mobile locations not serviced by Wi-Fi.

The SIM800L module (datasheet) is a great solution. It has a quad-band radio (850/900/1800/1900MHz) supporting 2G Global System for Mobile Communications (GSM) including data packet transport via General Packet Radio Services (GPRS).

The SIM800L can be simply wired to an Arduino UNO as shown here. The SIM800L is fairly easy to control using an AT command set or function from an existing library. Examples for both of these options are outlined in this quickstart tutorial.

As a first step, you might want to wire the SIM800L to the Arduino without the antenna feed line or the SIM card, just to make sure that you can get a response to an "AT" or an "AT+CFUN?" command. In the next step we will move on to using the SIM card.

Reference Links:

SIM800/900 GPRS Library

SIM800L AT Command Set

Step 4: Hologram - the Global IoT SIM Card

Picture of Hologram - the Global IoT SIM Card

HackerBoxes is very excited to partner with Hologram to bring you this ready-to-use, global IoT/M2M SIM along with a $5 promotional balance.

To mitigate the various challenges in putting your project or product online anywhere, Hologram has built a global SIM and cell network built for IoT and M2M data with simple activation and transparent pricing. The Global Hologram Cellular Network support connectivity in over 100 countries allowing us to connect our IoT devices seamlessly from one country and carrier to another.

Follow the links here to activate your SIM. You will see a link to "Apply Promo Code" where you can enter the activation code: HACKERBOX5.

The Hologram SIM card is a triple SIM. Be sure to only pop out the microSIM, which is the size used by the SIM800L modules.

Hologram has put together a wonderful Cellular IoT Tutorial and library that leverages the components in this HackerBox. Definitely check it out!

Step 5: Bare Metal

Picture of Bare Metal

Programming on the "Bare Metal" or "Near the Metal" or "Close to the Metal" is defined by Wikipedia as programming a machine without an operating system, which is a bit of an over-simplification. After the development of programmable computers, which did not require physical changes to run different programs, but prior to the development of operating systems, programs were fed to the computer system directly using machine language by the programmers without any system software support. This bare metal approach bootstrapped the development of operating systems. Modern operating systems evolved through various stages, from quite elementary to the present day complex, highly-sensitive, real-time systems.

Today, bare metal work is mostly applicable to embedded systems and firmware, while everyday programs are executed by a runtime system within an operating system. That said, even the Arduino platform that has become almost ubiquitous in the embedded world, uses a bootloader and various libraries to abstract us away from the metal of the AVR microcontroller. It is time to dig deeper.

Step 6: DIY Arduino From a Bare AVR Micrcontroller Chip

Picture of DIY Arduino From a Bare AVR Micrcontroller Chip

Starting with a stock (completely blank) ATmega328P chip, you can do some amazing things. This the same chip that is used on the Arduino UNO R3 boards. The ATmega328P is a high-performance 8-bit AVR RISC-based microcontroller. It combines 32KB ISP flash memory with read-while-write capabilities, 1024B EEPROM, 2KB SRAM, and 23 general purpose I/O lines.

Take a look at the schematic shown here with the components needed from the HackerBox.

This video tutorial from PyroElectro shows how to wire up a DIY Arduino on a breadboard from components.

Notice that the schematic we are using here has a slight variation from the one in the video. While the video shows use of a battery and a regulator circuit as the power supply, we are simply using the 5V supply from the Serial-USB module. The Serial-USB Module uses the CP2102 bridge chip. If you do not have drivers installed for this chip, they may be found here.

Another important difference is that the video tutorial assumes that the ATmega328P chip already has an Arduino bootloaded burned onto it. Since we are starting from a blank chip, we will need to need to program the bootloader onto the ATmega328P chip. We can use the UNO as an In System Programmer (ISP) as shown under the Burning The Bootloader heading on this page.

Step 7: Online Course for Microcontrollers From PyroElectro

Picture of Online Course for Microcontrollers From PyroElectro

The PyroElectro video in the last step is actually just one part of an entire ten lesson online course covering microcontrollers. You may wish to work through the other lessons as well. You have all of the necessary components in HackerBox #0016 to do these lessons aside from some of the extra "user interface" components used in lesson 8. As an added exercise, see if you can replace these hardware interface elements with a user interface leveraging the serial monitor.

Lesson 10, AVR vs Arduino, covers precisely the "bare metal" issue we are addressing here, so we definitely recommend that you at least watch the video for Lesson 10.

Much respect for the work done by PyroElectro on these lessons.

Step 8: Minimal Arduino With the 8-pin ATtiny85

Picture of Minimal Arduino With the 8-pin ATtiny85

The ATtiny85 is a great option for running simple Arduino programs. It’s small, cheap, and relatively easy to use. Compared to the ATmega328P (from the Arduino UNO), the ATtiny85 has fewer pins, meaning you can’t connect as many components. It has less flash memory (8KB instead of 32KB), meaning your programs can’t be as big. It has less RAM (512 bytes instead of 2KB), meaning you can’t store as much data. And there’s no hardware serial port or I2C port, so communication can be a little trickier. However, if your project requires only a few simple inputs and/or outputs, you’re probably fine using an ATtiny85.

This tutorial from High-Low Tech can show you how its done!

Step 9: Assembly Language for AVR Microcontrollers

Picture of Assembly Language for AVR Microcontrollers

Now that we've used bare AVR micros to build up DIY Breadboard Arduinos, we can go a step further and drop down to writing machine code directly on the chip. This is an advanced topic, but there is no better way to learn the deep details of how processors work. Luckily, there is an entire online book covering the subject of AVR Assembly Programming.

Note that you can also embed inline assembly code within a traditional Arduino program when added efficiency or tight execution is called for.

Further down the rabbit hole, you might want to explore more of a general or academic view of assembly/machine programming and how it relates to the underlying computer architecture. If so, check out the CMU lectures on Computer Architecture or the lectures and slides for CS24 at Caltech.

Step 10: Hack the Planet

Picture of Hack the Planet

Thank you for joinging our adventures into mobile cellular IoT/M2M communications and bare metal computing. If you have enjoyed this Instrucable and would like to have a box of electronics projects like this delivered right to your mailbox each month, please join us by SUBSCRIBING HERE.

Reach out and share your success in the comments below and/or on the HackerBoxes Facebook page. Certainly let us know if you have any questions or need some help with anything. Thank you for being part of HackerBoxes. Please keep your suggestions and feedback coming. HackerBoxes are YOUR boxes. Let's make something great!


supersharp (author)2017-03-15

My box contained two "220" ceramic caps instead of the "22" indicated in the tut and images. If I use these 220 in place of the 22 is this going to hurt my board or PC? If so is it possible to mail me the 22's I was supposed to receive? My local Radio Shaq doesn't carry 22's so this is mildly inconvenient for me.

Those should be 22pF caps which should be correct for the timing crystal.

These are the caps that came with my package in place of the 22pF.

bitanalyst (author)supersharp2017-06-10

This confused me as well, apparently 22pf capacitors can be marked either 22, or 220.

Those look like 22pF caps to me :)

To clarify, youve got the correct parts. ?

_benstr made it! (author)2017-04-22

Hey folks, I noticed lots of ya were having issues with the SIM800 module. I made an Arduino library and tutorial to help everyone out. Enjoy!

GrantB29 (author)2017-03-26

I'm not sure what the issue is, I've done both the HackerBox way and jasper_fracture's way, and I can't get it to send an SMS. Every AT comes back as OK and it has good reception and connectivity and all that happy blah blah blah.The power is hooked up externally from my PC, not through the USB port. In the Serial Monitor I get an error after inputting /032 from the jasper tutorial, but I get the SMS Sent! from the HackerBox one. I'm lost, frustrated, annoyed. Yes, I'm putting my personal cell number in the code...

jasper_fracture (author)GrantB292017-04-01

Hi Grant -

Regarding my tutorial, it sounds like you might have an incorrect setting in the Serial Monitor. Check out the subreddit thread at:

Can't guarantee it's the exact same problem Anand was having, but it sounds similar.

  • select "Use NL & CR" (be sure your baud matches the code you're using....mine used 9600)
  • close the Serial Monitor
  • power cycle/disconnect/reconnect USB from UNO
  • re-open Serial Monitor, try AT command again

Good luck with it. :)

migotwo (author)GrantB292017-04-01

I am in the same boat. Everything acts like it should send normally, I get an Error in the same spot as you. So I found some info on getting more than just "Error" put AT+CMEE=1 or 2 for verbose error output with an error code. Then try your sending again.






+CMS ERROR: 2172

SeanM315 (author)GrantB292017-03-30

Allow me to share the burden of frustration my brother! ;)

I have been struggling with the same issues where I've finally got to the point where everything appears to be sending correctly from the GPRS module but I could not see anything on the Hologram Dashboard to corroborate that anything was being sent.

Yesterday, I noticed that my Hologram card account balance was dropping which led me to the billing section of the Dash. I can see the transactions that prove that I am communicating to Hologram correctly but I am not receiving these text messages. I'm pretty DANG happy that I at least see the transactions but the text message would be nice too.

You should verify in the billing details too. It may bring clarity.

All the best!


SeanM315 (author)SeanM3152017-03-30

I just saw this in the Hologram Community Forum. This might help!

AnandS80 made it! (author)2017-03-29

Location Tracker was made using SIM800L module. It will be used to fetch nearby cell tower information. Using this data custom web link will be printed on serial monitor. When user visits that web link, current approximate location of SIM800L module will get displayed.

Git Repo:

rmartinezv (author)2017-03-18

I have an issue, and according what I was reading is the power issue, the D2 light just keeps hold for a little, it blinks every 5 seconds, so I guess I'll need a external power supply. thanks to @jasper who made a lot better tutorial that the one here.

Well, likes last one, a lot of little issues. Not really exited by this last two boxes, hope next one be better.

Hi Martinez -

Thank you!

You may have a problem with cell reception. Try the AT command: AT+COPS=?

It should return something like: +COPS: (2,”T-Mobile USA”,”TMO”,”310260″),,(0-4),(0-2).

If you get something like: (0-4),(0,2), I think you might have reception issues.

I'm going to try this tonight, thanks for the answer. Quick question, when I activate the hologram I choose region 1, do you think is better option choose region 2? I'm on the United States and both shows in the map.

I'm really not sure on the zones. Hologram has a "Live Chat" feature on their website which would probably get you fastest answer. If you're in a rural area like me, reception might be a problem until you get closer to a tower that the SIM800L can work with.

Also, if you have a big cap like a 470uF, try putting it across the power rails supplying the SIM800L. That really seemed to help me. Either way, good luck with it - be interested to hear if you get it working.

TimGTech (author)2017-03-01

OK this is driving me nutz!!! It's not connecting to the cellular network it seems. I activated the SIM ok. I have everything wired properly. I tripple checked wiring and code. Then I ate a Nutty Bar and checked it again! AT command responds "OK"

But - AT+CREG? = 0. I assume that's meaning its not connected. The Hologram Dashboard doesn't show any data either.

SanticN4N (author)TimGTech2017-03-19

Was this ever resolved? Having the exact same issue.

TimGTech (author)SanticN4N2017-03-19

I got this response from Ryan @ Hologram as the proposed fix. I have been so busy I have not had a chance to try it myself. I hope to give it a whirl within the next few days and will post my results back here.

Hi @TimGTech
For some reason the SIM800 sent requires a SMS config. This blog post explains the steps
Basically run this command: AT+CSMP=17,167,0,16 . The post explains things in more detail.
If you could try this, then we can go from there. @benstr

SanticN4N (author)TimGTech2017-03-19

I saw that answer on their forums and i tried it with no success. I opened another topic with hologram to see if i can get any success. It is strange I can receive sms fine but I cant send any.

_benstr (author)TimGTech2017-03-01

Hey Tim, what does `AT+COPS=?` return?

TimGTech (author)_benstr2017-03-01

Hi Ben

AT+COPS=? = +COPS: (2,"T-Mobile USA","TMO","310260"),,(0-4),(0-2)

So I guess maybe it is connecting?

mainegeek (author)TimGTech2017-03-01

I am also having a similar problem. COPS=? returns the same result T-Mobile.

I set at+cgdcont=1 to the following
+CGDCONT: 1,"IP","hologram","",0,0
+CGDCONT: 2,"IP","","",0,0
+CGDCONT: 3,"IP","","",0,0

And if I run at+cgact=1,1 I get an IP
+CGDCONT: 1,"IP","hologram","",0,0

I still cannot send an SMS. I've even tried a program called "AT Command Tester" to make sure I wasn't doing anything wrong and it doesn't work either.

When I attempt to send the SMS I don't get an error back either.

Hologram's portal shows my SIM card as live but shows no data having passed through it.

I'm at a loss...

TimGTech (author)mainegeek2017-03-02

Sounds like we have the same issue. I posted in the Hologram forum. Any feedback or resolution I get from there I will post back here.

_benstr (author)mainegeek2017-03-02

Yep, you are connected. The nearest tower must be TMO. No need to set the APN when only sending SMS. The APN is for sending/receiving data to the cloud. Can you open a post in our forums and we can dive deeper into the issue.

TimGTech (author)_benstr2017-03-02

Thank Ben. I have a post on the Hologram Community forum. Hopefully it will get worked out. I'm hoping to get it working. At least to be able to send SMS messages.

_benstr (author)TimGTech2017-03-02

Yep, you are connected. The nearest tower must be TMO. Can you open a post in our forums and we can dive deeper into the issue.

TimGTech (author)_benstr2017-03-01

AT+COPS? = 0

BrettR3 (author)2017-03-04

Interesting article. Looks like we have a year to play with the this SIM module in the US.

ScottC272 (author)BrettR32017-03-16

I think only AT&T has sunset their 2G network (it caused a lot of trouble in the SF Bay Area because the bus service hadn't updated to 3G for their real-time tracking). T-Mobile has been reaching out to people cut off by the AT&T sunset, so hopefully they keep it going.

urgemore (author)2017-03-15

Yep, I'm just not getting a connection to the network. Wired up correctly, SIM in correctly, one solid red light, one blinky red light.
AT+COPS=? gives me "+COPS: ,(0-4),(0-2)".

ibyte8bits (author)2017-03-06

What am I doing wrong?

Setup Complete!









SMS Ready




+COPS: (1,"T-Mobile USA","TMO","310260"),,(0-4),(0-2)




grtyvr (author)ibyte8bits2017-03-06

I don't think you need the + in front of the country code. At least I did not.

ibyte8bits (author)grtyvr2017-03-11

With or without "+", same problem.

grtyvr is need for +1

Also instead of "AT+CMGW", try using: AT+CMGS="1AREACODEYOURNUMBER"

If you're entering the text in through the Serial Monitor, you're going to need a way to send "Ctrl-Z" to end the text body entry.

There's a demo on my site that might help. Good luck with it! :)

wh0c4rez (author)2017-03-02

Really can't figure out what the heck is wrong with not being able to send out an SMS. Attached is an image of my setup. I am not using the board sent with the kit, as I thought that might have been contributing to the issue, but it's not apparently. Running the following code:

Sketch: GPRS Connect TCP

Function: This sketch is used to test seeeduino GPRS's send SMS make it work,
you should insert SIM card to Seeeduino GPRS and replace the phoneNumber,enjoy it!
note: the following pins has been used and should not be used for other purposes.
pin 8 // tx pin
pin 7 // rx pin
pin 9 // power key pin
pin 12 // power status pin
created on 2013/12/5, version: 0.1
by lawliet.zou(
#include <gprs.h>
#include <SoftwareSerial.h>

GPRS gprs;

void setup() {
Serial.println("GPRS - Send SMS Test ...");
while(0 != gprs.init()) {
Serial.print("init error\r\n");
Serial.println("Init success, start to send SMS message...");
gprs.sendSMS("757XXXXXXX","Hello World!"); //define phone number and text

void loop() {
//nothing to do

This is the output to the Serial Monitor:

GPRSck failed!
GPRS - Send SMS Test ...
Power check failed!

My "Ring" LED on the SIM is light solid (mostly, it "resets" every so often) and the "Net" LED flashes about 1 to 2 times/second.

I have NO idea why I cannot get this to work. When I've run other code to issue AT commands, my +COPS returns +COPS: (2,"T-Mobile USA","TMO","310260"),,(0-4),(0-2) so I should be able to send an SMS based on my review of other posts below.

P.S. I changed the code for my phone number to the XXX's here, it's correct in the uploaded Sketch.

wh0c4rez (author)wh0c4rez2017-03-03

I've modified my code a bit to add a notification via Serial Monitor after a text is "sent" as seen here:

Serial.println("Init success, start to send SMS message...");
gprs.sendSMS("1757XXXxxxx","Hello World!"); //define phone number and text
Serial.println("Text sent successfully");

Now, I am getting the following output on the Serial Monitor:

GPRS - Send SMS Test ...
Power check failed!
Init success, start to send SMS message...
Text sent successfully

So, there seems to be some holdup on being able to issue the CMGF command. Without being able to set AT+CMGF=1, a standard SMS can't be sent. Don't understand why it cannot do this.

jasper_fracture (author)wh0c4rez2017-03-03

Hi - I just posted a short tutorial on what did to get ours working:

We found that the 800L board was a little finicky.power seemed to be an issue. Powering from a bench power supply at 5V, 2.5A seemed to work a lot better than USB/micro. Also, putting a 470uF capacitor across the 800L power seemed to help stabilize things.

hi, can you show us how you fix that with the capacitor? An image would be very helpful. :)

Hi, I posted a guide on how to use the SIM800 to send data to a webpage via HTTP GET, and the image for that post shows the 470uF cap on the power rails next to the board:

wh0c4rez (author)jasper_fracture2017-03-03

So, a combination of things have made it work. Not sure which was the most responsible. I pulled out a USB module from a previous HB (was used for programming the Arduino Mini's), set it up to deliver 5v, and used it via a USB port on my computer to provide power. Then I used the code @jasper_fracture provided in the link above. Have now successfully sent three texts to my phone. I am investigating Jasper's code to see if maybe there is something there that I missed (I doubt it) just in case. Thanks for the help!

grtyvr (author)wh0c4rez2017-03-07

Try going back to powering the device from the Arduino. It took at least 20 minutes for the sim to register on the network and for texts to start flowing for me.

grtyvr (author)2017-03-12

So I put a bootloader on the atmega238P and made a video about the process.

Thanks again to HackerBoxes for some fun parts and good hints as to what direction to move in. If you need more step by step, this video might help you.

RyanIsqairde (author)2017-03-11

The instructions for these are not very beginner friendly. Step by step instruction would be far more useful than just saying 'wire this to that'

Do I need to provide my own female plugs for the SIM card? I'm confused about what I was supposed to plug them into the Arduino with?

nevermind I'm stupid, I've moved into the testing phase at the 'without the sim or antenna' section.

Not really sure what to do to test it here, obv some code in the Arduino ide.... Hopefully I can figure this out without causing an hemorrhage.

Sorry I'm such a newb! Haven't messed with code since I helped make a game made with lwc, that was over 15yrs ago. Got this for me and my son. Our first box. I have found the link to the code that communicates to the sim800. Now to figure out how to use these test commands....

SteveM13 (author)2017-03-08

Going to try FreedomPop with the GSM module. The service is free - it sucks - but it's free. Got the SIM for $5.

Czar (author)SteveM132017-03-11

Where'd on their site did you see the options to sign up for such service? Do I need to find their 2G service for IoT type stuff?

About This Instructable




More by HackerBoxes:HackerBox 0025: Flair WareHackerBox 0024: Vision QuestHackerBox 0023: Digital Airwaves
Add instructable to: