megaPhone – William Easdown Babb https://weasdown.com Space, photography and projects galore Wed, 26 Jun 2019 10:31:35 +0000 en-GB hourly 1 https://wordpress.org/?v=6.7 https://weasdown.com/wp-content/uploads/2018/05/cropped-DSC01950-e1526771946901-1-32x32.jpg megaPhone – William Easdown Babb https://weasdown.com 32 32 141140697 megaPhone #2: Changing processor https://weasdown.com/2019/06/24/megaphone-2-changing-processor/ Mon, 24 Jun 2019 21:57:42 +0000 https://weasdown.com/?p=1074 Today on the blog, I’d like to discuss an important change to my megaPhone project: I’m switching the processor from the ATxmega384C3 that I’ve been baselining thus far to an ATSAML21G18B. I’ve listed some key characteristics of the two MCUs in the table below.

ATxmega384C3ATSAML21G18B
Max speed (MHz)3248
Architecture8-bit AVR32-bit ARM Cortex-M0+
Program memory (kB)384256
SRAM (kB)3232
Pin count and package64-pin QFP48-pin QFP
Power consumption at max speed (mA)10-15Up to 4.56
Price (£)6.584.32

You can see that the SAML21 beats the xmega384 in almost every respect, including price. I find it really amazing that you can get an ARM Cortex-M0+ processor for only £4.32 (including VAT). When I discovered Microchip’s range of 32-bit microcontrollers, I was keen to see how they compared to the ATxmega384C3, which sits right at the top end of the AVR lineup. I found, using Microchip’s handy comparison table, that even a relatively low end 32-bit device like the SAML family can go up against the xmega.

The smaller package for the SAM will give me more space on my board for other components and the much lower power consumption will help to give the megaPhone a long battery life. The lower price than that of the xmega is also very welcome to bring down the phone’s overall cost.

Given how complex the code for the megaPhone is likely to become, and given my lack of experience at writing code that doesn’t take much program memory, I wanted to make sure I had plenty of memory in my processor. This is why, when I was choosing the xmega, I went for the 384C3 version with 384kB of Flash program memory. I suspected this to be a bit of an overkill though, so I’m not really worried about reducing this to 256kB in the SAM chip.

Overall then, the ATSAML21G18B is a very worthy replacement for the ATxmega384C3, with better performance and much lower power consumption, in a smaller package and for less than two thirds of the price.

I/O Requirements

The SAML21 family is available in three different package sizes: the L21E series has 32 pins, the G series 48 and the J series 64. So why did I choose the 48-pin G series for this project?

One key aspect of choosing a processor for the megaPhone is making sure it has enough input and output (I/O) pins. To do this, I made a list of all the peripherals it’ll be connecting to, along with how many pins each peripheral needs. These details are shown in the table below.

FunctionNumber of pins required
USB2
GSM module9
Display4
Keypad7
Direction buttons5
Battery voltage sense1
Vibration motor1
Total29

The SAMD21G18 has 37 pins that can be used for I/O, as shown in the pinout below, so has enough to accommodate the 29 pins needed for the phone’s components.

ATSAML21G18B pinout

Development Changes

This change is processor necessitates a change to my work done so far: I need to change the device in my schematic and board layout. This is a relatively small change, particular given that not much had been connected to the xmega, so should only take a day or two.

I’ll also need to familiarise myself with the registers in the new processor, although many of their names are the same as those found in the xmega. I’ll be reacquainting myself with the use of pointers to manipulate registers, with the new processor commonly using 32-bit registers compared to the 8-bit registers found in the old chip.

Breakout Board

So how will this affect my breakout board for the ATxmega384C3? From now on, the breakout board will no longer be on sale, as I will not be using it for development of the megaPhone. However, if you’re particularly interested in buying the parts for a board, send me an email using my contact form and I’ll get back to you regarding cost and getting the parts shipped to you.

SparkFun’s SAMD21 Mini Breakout

I still need something to develop my software on though before I send my PCB to manufacture. The SAMD21 family, which I’ll go into more detail about below, is very similar to the SAML21, so I’ll make use of one of the many breakout boards already available for that range of microcontrollers (such as the mini one from SparkFun). This was another advantage of switching the processor – I can use a known-good board for development so I can be sure that any problems are in my software.

The ATSAML21G18B is very similar to the ATSAMD21G18 used in the SparkFun board and the Arduino Zero, meaning that lots of people will already have developed code for this platform that I can use for debugging if needed. However, I’ll be developing my code in C in Atmel Studio 7.0, avoiding the overhead and extra layer of abstraction produced by using Arduino code.

I did consider using the ATSAMD21G18 for the megaPhone, and this would have made software development very easy by being able to directly transfer it from a development board to the final hardware. However, the SAML21 family adds a power management module, allowing greatly reduced power consumption (for example, using 1.92mA to run a Fibonacci algorithm at 48MHz versus around 4.53mA at 32MHz for the SAMD21) for only a modest increase in price (£4.32 versus £3.12). With long battery life being a primary concern for a mobile device like the megaPhone, I think the extra cost is very justifiable, and I’ll be making good use of the SAML21’s power management capability. The SAML21 is also almost pin compatible with the SAMD21, making porting of code from a SAMD21 breakout board easier.

Naming

One final, but important potential change to the project is its name. The megaPhone is so called because of the xmega processor that was found at its core. Now this has changed to a SAM chip though, I should probably think of a new name. SAMphone’s ok, but I’d love to hear if you have any suggestions for a good name for the project – let me know in the comments below. If there any features you think the phone really needs I’d really love to hear about them in the comments too.

As always, you can find all my posts about the project here on my website and under #megaPhone on Twitter (for now at least and if I decide to stick with the current name). I’m currently working on a requirements document for the phone, which I’ll be releasing on this blog once complete. I have plenty more work to do too though, so see you in the next blog post!

]]>
1074
megaPhone #1: Initial Choices https://weasdown.com/2019/05/21/megaphone-1-initial-choices/ Tue, 21 May 2019 16:25:43 +0000 https://weasdown.com/?p=1029 Read more…]]> So, my megaPhone project is underway! The first step in designing the phone is to get an idea of what it should do. This could range from just calls and texts to full smartphone functionality… In this case, I’ll be keeping the functionality fairly simple initially, but I’ll design the phone so extra software features can easily be added later.

Of course, the bare minimum functionality for a mobile phone is to make phone calls. My aim with this project though is to make a phone with similar functionality to that available in around the year 2000, but with modern components. This means I also need to add SMS messaging, and should consider adding features like a calculator too. Luckily for me, many of these extra little features don’t require any extra hardware: a calculator can be a separate ‘app’, various ringtone options can be stored in the microcontroller’s large memory, and so on.

The original Nokia 3310 is one of the world’s most famous candybar phones.

For the megaPhone then, my hardware just needs to enable calls and texts and some form of user input. In keeping with the design of phone from around 1998 right up to today’s feature phones, the megaPhone will use a candybar form factor. This puts a keypad below a small screen. In the case of the megaPhone, I’ve decided to use a small colour LCD for the screen. The colour display is one of the modern touches that will distinguish the phone from true 2000’s phones. Of course, the use of a keypad rather than a QWERTY keyboard or touchscreen will mean that to send texts, the user will have to use the classic method of multiple button presses to pick the letters in their messages.

Another modern twist in the megaPhone will be the USB Type-C connector for charging. Many phones in the early noughties used barrel connectors for charging, with mini USB being used by some phones like the famous Motorola RAZR V3 later on. I want to make sure though that the user doesn’t have to buy a separate charger, and the reversible nature of Type-C makes it easier to use than mini or micro USB. Using Type-C in the megaPhone will also be good experience for me, so I can use it and its Power Delivery protocol in later projects.

The megaPhone’s body is the area where a high quality design is most important to make the megaPhone the really professional-looking product I hope it to be. I’d love to make the body out of machined aluminium, for its amazing looks and to grow my skills with CNC, but this would require an advanced antenna design to make sure the phone electronics could communicate with the outside world. Instead then, I’ll have to make the body from plastic. This will be 3D printed – for small numbers of units processes like injection moulding are prohibitively expensive, but if there’s sufficient interest in the project I may consider launching a Kickstarter campaign to make injection moulded bodies. 3D printing may be a method mostly associated with the maker community, but that doesn’t mean it can’t produce professional-looking results. I intend to fully utilise the design freedom that 3D printing gives me to design a really attractive and ergonomic body for the megaPhone.

I am baselining the SIM5320E GSM module for use in the megaPhone.

One of the first components I need to choose for the electronics is the module I’ll be using to connect to the phone networks. I have decided to baseline the SIM5320E GSM module for this. This can use 2G and 3G frequencies, meaning I’ll be able to use the megaPhone in the UK, where 2G networks are being phased out. If I find a module that provides more useful functions, I may switch to it down the line, but for now the SIM5320E seems like a good starting point and offers similar functionality to the popular SIM808 module that is often used in hobbyist GSM breakouts.

At the moment then, I’ve chosen which microcontroller and GSM module I’ll be using in the project, and need to choose the rest of the important components like the buck converter that will take the 5V USB input and turn it into 3.3V for the phone electronics. I’ll be updating the blog with my progress as I go, so make sure to keep an eye on my megaPhone page and subscribe to my blog to keep up to date.

]]>
1029
megaPhone: A New Project Begins! https://weasdown.com/2019/04/26/megaphone-a-new-project-begins/ Fri, 26 Apr 2019 18:51:37 +0000 https://weasdown.com/?p=908 In this past couple of weeks, I’ve begun a new project; a mobile phone that will be based around an ATxmega384C3 microcontroller, which I’m calling the megaPhone. There are a few homemade phones on the internet, such as David Hunt’s PiPhone and David Mellis’ DIY Cellphone. I’d like to have my own go at it though, to give myself practice with PCB design and manufacture on a fun project and so I can learn about how USB works (more on that in a minute).

My requirements and functionality for the phone are the following:

  • Send and receive calls and texts
  • Look professional
  • Use USB Type-C for charging/connecting to a PC
  • Battery life of at least two days

I’ve chosen to use USB Type-C as it is the USB connector of the future and is now entering the mainstream, but also offers a great deal of flexibility with protocols such as USB Power Delivery (PD). While my megaPhone won’t need to make use of any of these advanced protocols, I’d like to build up experience with Type-C hardware so I can look to implement protocols like PD in later projects.

The design is in an early phase of development at the moment, so I’m investigating which components will best fit my needs. For the screen, I’m aiming to use a small OLED (organic light-emitting diode) screen, due to their low battery usage compared to LCDs and high contrast. For prototyping, I’m using the 1.3″ screen bought off eBay that you can see at the top of this post. The battery will be a small Li-Po unit, probably around 1 Ah in capacity. These are very widespread and provide a good amount of capacity in a small package.

I also intend to use this project as an incentive to learn how to do computer-aided manufacture (CAM) in Autodesk Fusion 360. To that end, I’m going to try to make the case for the megaPhone out of milled aluminium, which will definitely help towards my aim of making the phone look professional.

So, follow along as I start this exciting new project. I’ll be tweeting about it with #megaPhone and you can find all my posts about it under the megaPhone category on my blog. And don’t forget to subscribe to my blog for email updates on my progress (don’t worry, they won’t be too frequent)!

]]>
908