Sim 800

//Rough Draft but I am posting anyway. Need to add pics and links 🙂

So I have been experimenting with the SIM800 module. I got the coreboard from Aliexpress for $5 and what I got was this…<insert pic>

My first attempt to power it from the arduino VCC to 5v and GND to GND failed. I was surprised. The module had spoilt? Google to the rescue. It turns out, I was to blame. I didn’t read the datasheet. The VCC require is 3.6v to 4.4v with 4v being recommended. I connected it to 5V. Yikes! Got to say thumbs up to the engineers that my module didn’t immediately emit the magic smoke. It also turns out, that I didnt consider the current the module requires to startup. There is no way the arduino pins can supply such amount of current.

What’s the Solution?

The solution is actually pretty simple. First, I got a hint somewhere that I could take advantage of a diode to reduce the voltage. That’s superb actually since diodes typically have a forward voltage of 0.7v. With two diodes, I can drop the 5v supply to 3.6v. Cool. For the supply, I made use of a 5v 2A supply. (just another phone charger,with the micro-USB end cut off and connected to a breadboard).

<insert pic of circuilt here and perhaps circuit diagram too>

The Arduino side of things.

Upload this on the arduino

#include <SoftwareSerial.h>

SoftwareSerial SIM800(8,7);

void setup() {

// put your setup code here, to run once:

Serial.begin(9600);

while(!Serial);

SIM800.begin(9600);

delay(1000);

Serial.println(“Setup Complete”);

}

void loop() {

// put your main code here, to run repeatedly:

if(SIM800.available()){

Serial.write(serialSIM800.read());

}

if (Serial.available()){

SIM800.write(Serial.read());

}

}

Connections

Connect the D8 of the arduino to the SIM800 TX pin and the D7 of the arduino to the SIM800 RX pin. Make sure to connect the ground of both modules to each other – they should share a common ground.

Connect the VCC of the sim to the 5v supply but with 2 diodes in series. Connect the ground to the power supplies ground. Your module should come on.

Make sure the arduino is connected and the code above has been uploaded successfully. Open your serial monitor. After a short while, you should see “Setup Complete”, to test that your setup works, type AT and press send. You should get ok as a response. You are good to go. You can now experiment with other AT commands.

Updates

It still doesn’t work with a sim. It can’t see the two sims I have put in it. I can’t make calls. Perhaps I need a special kind of sim. Sigh.

References.

I adapted code from http://www.ayomaonline.com/programming/quickstart-sim800-sim800l-with-arduino/

Pro Mini vs. Nano vs. Uno

I recently acquired new hardware components among them are some arduino nanos and pro minis. I got them because I wanted to investigate their use as low-cost alternatives to the uno. The uno is about $25 dollars , and you could get clones for as low as $15 but the nano cost about $2. $2 !!

So what’s the same? 

First, they all (or have a version ) run on a 5v. They share the same microcontroller core- the Atmega328 .They have the same number of analog input pins. Some of the digital pins can do PWM. And A4 and A5 can be used for I2C .

What’s different?

One difference is that the uno has max 20mA per digital I/O pin. The Nano and the Pro mini have max 40mA per digital I/O pin.The pro-mini doesnt have an on-board 3.3v regulator. Asides from that, there are hardly any differences between the boards.

So why the price disparity?

Well, the Uno is bigger and has components that enable it connect to a power jack. I would say if you are cost-conscious and don’t need any specialized functionality, go for the pro-mini or the nano. There are smaller, cost less and are just as cool!

References.

https://www.arduino.cc/en/Main/ArduinoBoardUno

https://www.arduino.cc/en/Main/ArduinoBoardNano

https://www.arduino.cc/en/Main/ArduinoBoardProMini

 

June Review: It’s July already!

June was.. I dunno. It just passed. By all my usual measures of progress, I didn’t make a lot of progress. I can’t recall reading any book or coding or doing some project. It just passed by. I guess I lost a bit of steam. I was tired. I was paralyzed by fear, unreasonable fear that lead to procrastination. It feels like I haven’t got my life in as much order as I thought. All of this might just be post-Nysc blues. I still have a bit of reflection to do. There are issues to be resolved

What do I hope for/what am I doing in July?

I need to be more positive. Get my morning routines. Finish the work on Afrimakers, meet new people. Finish my applications. Participate in the Cyberlympics. Be done with U.I. Read some books. Do some projects. Tinker. Drive. Kiss a girl. Have fun.

Book Review : Think and Grow Rich

A friend recommended this book to me and I decided to read. I used to have this cavalier attitude to riches; to money in particular but this challenged my views. It is a book about money but I think it is about more than that. It is about being a success.
First, you must have an intense desire for riches. A hunger. A will. A passion. That’s the very first step. You should visualize in your mind’s eye the exact amount you want. You need to get specialized knowledge. You need to plan. You need to make a decision; not be hindered by procrastination and indecision. You must perserve. You need to surround yourself with the right people. Master sex transmutation. Work on your subconscious mind and outwit fear.

I like it though it was mystical in parts. I am not sure what to make of those parts but it was great overall. The big gain for me was realizing I need to believe in my dreams and go for them. Plan and believe I would succeed. Be confident and assured; not be scared. This book merits a second read which is perhaps one of the highest compliments any book can get.

April Summary

So what was I up to in April?

I was reading two books on Embedded Hardware. Designing Embedded Hardware and Embedded Hardware Know it all. I skimmed through Designing Embedded Hardware but skipped large parts. It was a good overview of the scope of things I should aim to know. For Embedded Hardware Know it all, at some point it became too encyclopedic ,  I decided to stop. I finally did the How the Arduino works post. I started CS50 and Embedded Systems on Edx. I went for the Hackaday world create day event. I participated in Hackerrank competitions. I wish I performed better in them though. I finished the Art of Learning. I participated in the Lagos Hackathon. That’s it.

Book Review : Art Of Learning

This is basically the autobiography of Josh Waitzkin. He tells of his days playing chess and then how he made the transition to martial arts and drops some tips on learning along the way. I enjoyed reading his story but I kept expecting that at some point his story would end and the lessons on learning would begin but it never happened.
It wasn’t a total waste.
Book should have been called ” My life” or “How I learn”. The biographical content was too much.

Hardware education so far

So I shifted focus back to hardware. I have been doing a lot of software; practising python on hackerrank, learning c/c++ and solving project euler questions. I picked up two books to start with – Designing Embedded Hardware and Embedded Hardware Know it all. They were good at the start but started getting hard to grasp towards the middle. It was a lot to ask to go through them thoroughly cover to cover. I have now decided to not do that.

In Designing Embedded Hardware, I felt the knowledge would be lost since I wasn’t getting hands-on with the processors that were discussed. I have gone through the book cover to cover but I skipped some parts, I would reference them when I need them.

I am back to treating Embedded Hardware Know it all as reference material too. I’m sure that’s what the authors intended but I felt I could understand it all. I like the early chapters and I would be reviewing the notes I made from them. I plan to read the early chapters of Embedded Software know it all too and leave the rest till I need it or I am ready to focus on understand a particular topic.

What next?
I need to refresh my knowledge of electronics. There might be little details I might be missing. I just understood what it means for a pin to be tristate. I want to make sure I fully grasp things like that. I am going to be studying opensource designs – hardware and software. I have already started with the arduino. I believe understanding what exists would help when one wants to design his own systems. I better appreciate how far I have to go. I am going to also do some simple projects with the electronics I have with me at the moment. I don’t want to just follow some tutorial and I dont want to just hack and get it to work (that’s cool by the way). I want to actually understand and engineer stuff. The goal is Mastery.

Understanding the Arduino Hardware

I will attempt to explain how the hardware works in this piece as far as I understand it at the moment.

Arduino2

ArduinoSch

So I decided to understand how the arduino works behind the scenes. I wanted to know what components it was made up of and how the components come together to form the whole system. Like every complex system , it is modular. There is the power system, that chooses between the power jack and the USB power and produces 5v and 3v3 for the rest of the system. There is a USB to serial controller that contains the bootloader which is used to load programs into the ATMEGA328P.

The Power System

Power1

If there is a power suply connected to the power jack. The power supply should be between 9v and 15v. The two chips are voltage regulators that produce 5v. I still dont understand why there are two voltage regulator chips.

The Vin is directly connected to the power supply.

Power2

Vin is connected to the LM385D chip which contains two op amps. One of the opamps is used as a comparator and the other is not used at all. 3V3 is compared to Vin/2 if Vin/2>3V3 then the output is 5v and that is used to turn off the supply from the USB. The 5v generated is then connected to the LP2985 chip which is a voltage regulator that takes in 5v and outputs 3v3 .

If instead Vin/2<3.3 , the mosfet is turned on and the USB power is used instead. USB provides the 5v to the LP2985 chip.

And that’s the power system.

USB to Serial Controller

The USB controller is implemented with the ATMEGA8U2-MU. It contains the bootloader code which is used to load the code unto the ATMEGA328P.

USBController

This includes support circuitry like the silicon crystals and the pull-up resistors. There is also the ICSP interface that can be used to program the chip. The ICSP connects to the microcontroller SPI interface.

The ATMEGA328P

This is the main controller. The code you write for the arduino is executed by this controller. And it is directly connected to the I/O pins. The controller is programmed via the TX,RX pins connected to the USB to serial controller

ATMEGA328P

 

And that’s it. This is relatively high level explanation. I will stop here for now. Next up, would be an explanation of the software.

 

Nysc over – Reflections

I am done with the National Youth Service Corp. (NYSC) I am officially a nigerian youth and no longer “Omo Ijoba” (hey, in the sense of not collecting stipend from gov anymore..not in the sense of mad). I didn’t like the idea of interrupting my life to go on some service. There was a risk I lost momentum; that my self-improvement efforts ended. The new environment might be horrible.
That didn’t happen. I took matters into my own hands.
I got a place of primary assignment through TA and my highlight was that I had a supervisor I could rap with – Engr. Kanmi. It was exciting to meet someone else that understood all the maker stuff and had passion and zeal for it. We could talk about happenings in that space, about ideas and it’s definitely something I would miss. I liked that I got to put my python skills to use in a project. I liked that I was able to read and develop myself even at work.

I liked living alone. I am glad I insisted on a self-contained apartment. I think I would have been a very snobbish roommate but I wanted to focus and I did.

CDS was routine. I was aloof. I can’t say I developed any long time friendships or did any community work. I guess I had the mindset that this time was for me. I needed to develop myself. And ultimately, although giving is nice, you can’t give what you don’t have. You have to focus on yourself too.

All in all, I am grateful I am done. I want to say a big thank you to my Mum and Dad for their support in all ramifications. I am grateful I have you guys. I can say I made good use of the time.
What next? There is a lot of work that needs doing. 🙂 . I will be fine. I want to continue pursuing the goals I have. Do stuff that matters.

Book Review : Good Maths

I loved this book. As a self-identified Math geek, once in a while I pick a math book to read. I thought I would learn stuff I knew already but with a different perspective – that happened but I also learned about new stuff, cool new stuff.
The authors covered topics like natural numbers, rational numbers, real numbers, complex numbers, transcendantal numbers, continuing fractions, egyptian fraction, set theory, computation etc.
The most exciting part was Set theory. I loved how he explained the need for a shift from Naive Set theory to ZFC. It was cool.
I didn’t understand everything especially the parts on computation; I lost patience towards the end but it was interesting getting exposed to this new maths. – Turing machines, Lambda Calculus, BrainF*** etc. I will definitely read again some other time. I strongly recommend if this is your thing