Close
0%
0%

Xling

A pocket demon named Exy.
Luci? Haven't heard about him.

dsldsl
Similar projects worth following
This is a pocket demon I've created for my wife. I used to think that this is how a modern Tamagotchi could look like initially. However, it can also be used as a battery-powered DIY platform to experiment with FreeRTOS and graphics.

Specifications

  • 35x47mm board
  • Monochrome OLED 128x64px
  • Low energy consumption (~20mA @ active, 0.75mA @ sleep)
  • Hand-soldering friendly (TQFP-44 0.8mm pitch, smallest is 0603)
  • 3D-printable case
  • Open Source Hardware/Firmware

Hardware

  • ATmega1284P 8-bit AVR MCU with 128 KiB flash and 16 KiB SRAM
  • SH1106G display controller
  • MCP73831 charge controller
  • AP3401 DC-DC buck converter
  • 400mAh 3.7V Li-Po battery (~26h @ active, ~30 days @ sleep)
  • Load-sharing circuit (can be powered by USB or battery, like a smartphone)
  • KiCad 5.1.0 project for schematic and board designs
  • Released under CERN-OHL-W v2 (Rev. 4) and CC-BY-SA (before Rev. 4)

Software

Please, note that the software part of the project isn't finished yet!

  • Shows a frame time, energy left and a battery charged status
  • Animation with Exy-in-the-bottle, a "personal daemon"
  • Programmed in C99 using the FreeRTOS kernel modified for ATmega1284P
  • There are three tasks only: Display, Battery Monitor and Sleep Mode
  • Released under GNU GPLv3+

Xling_v3.2_gerber_U2Pi_artwork.zip

Xling v.3.2 PCB gerber files with an artwork by U2Pi on silkscreen (doesn't usually render well by gerber viewers, but can be produced by PCB houses easily). Artist: https://www.deviantart.com/u2pi

Zip Archive - 533.63 kB - 03/24/2020 at 17:06

Download

Xling_v3.2_bom.csv

Xling v3.2 Bill of Materials (Text CSV)

Comma-Separated Values - 2.40 kB - 03/22/2020 at 13:01

Download

Xling_v3.2_bom.ods

Xling v3.2 Bill of Materials (Open Document Spreadsheet)

spreadsheet - 16.47 kB - 03/22/2020 at 13:01

Download

Xling_v3.2_schematic.pdf

Schematic for Xling v3.2

Adobe Portable Document Format - 151.11 kB - 03/22/2020 at 12:46

Preview
Download

  • Exy’s waiting to be animated more.

    dsl09/29/2020 at 19:16 0 comments

  • Xling v3.2 - updated board, PCBWay review and firmware bugs fixed

    dsl03/21/2020 at 19:06 0 comments

    Introduction

    I'm going to include a review for PCBWay service as a part of this update because they supported me with the current iteration of Xling v3.2 and manufactured black PCBs for free.

    However, I'd like to keep it as fair as possible because everyone should benefit in this case. On one hand, everyone who's reading it will be able to understand what PCBWay is capable of. On the other hand, PCBWay will be able to see what they might improve in their service.

    Personally, I'd like to thank DI HALT and his blog, easyelectronics.ru. I read it from time to time with pleasure. Besides, an article about PCBWay helped me a lot.

    Let me show you how Xling looks like in its current iteration fully assembled and in a 3D-printed case.
    Just as I imagined!

    How to configure PCB

    There are many parameters to tweak in order to quote a PCB production, and some of them might not be obvious enough. I'll try to describe them briefly and spend more time for obscure ones.

    Board type parameter means a way to prepare PCBs. You'll receive boards in single pieces in case of the first option which is suitable for prototypes or a small batch production. The second and third options which start with Panel by... might be useful in case of an automatic assembling and a mass production and allow you to select your own size of a panel (Panel by Customer) and let PCBWay populate it with your boards, or let PCBWay to do all of these steps (Panel by PCBWay).

    Please, note that in case of a single board it's necessary to select Size of a single board only, but in case of a panel, these are dimensions of the whole panel which might contain several boards. The same rules are applicable for Quantity which means a number of single boards or a number of panels accordingly.

    Generally speaking, it's not obvious why somebody would let PCBWay to decide how to panel her boards because dimensions of a panel depend on a specific assembly equipment. However, PCBWay offers an assembly service also and the third option is useful in this specific case.

    There are several ways how boards will be connected within a panel. In case of V-Scoring PCB material will be cut for a half of its height to simplify a break off. In case of Tab Route boards will be attached to a panel and among each other by narrow bridges.

    It might also be necessary to include different designs into a single panel, but it'll increase its price.

    Another option called X-out Allowance in Panel gives an incredible ability to reduce an overall cost of the panel by about 30%. It's useful if you can tolerate a PCB in the panel to fail electrical testing. It'll be marked by a cross in this case.

    You shouldn't usually worry about number of Layers because it can be obtained automatically from Gerber files provided within an archive.

    Material is what PCB is manufactured from, where FR-4 is epoxy glass cloth (the most widely used material for PCB, probably) and the rest.

    Personally, I'd like to mention FR4-TG which stands for a glass transition temperature and defines some thermal and chemical properties of the material. One of the most important things which is affected by this temperature is board geometry which is critical in case of really narrow routes and precision PCBs. The higher the temperature, the better PCBs can be manufactured, but overall cost will be increased also.

    Another important option is HDI (Buried/blind vias) which stands for High Density Interconnect PCBs. In this case RCC (Resin Coated Copper) is applied to epoxy glass cloth which leads to fine circuits.

    These are limits for tracks/spaces and size of the holes. Please, be careful and select them according to your design.

    It's interesting how minimal these options are. For example, you cannot select a limit for annular ring, but a diameter only. Personally, I'd recommend to read about PCBWay capabilities first in order to stay within limits and reduce amount of money to be spent on PCB production.

    There...

    Read more »

  • Xling v3.1 - an animation demo, more checkpoints, 4-wire SPI and FreeRTOS

    dsl11/17/2019 at 19:45 0 comments

    Almost a month and a half passed since the previous update (not so much comparing to v0.3, eh?) and I'm here to share some details regarding the overall progress.

    First of all, I've finally got rid of the leading zero in the Xling PCB version because there are no chances that I'll be brave enough to change it in future. So, v0.3.1 became v3.1 and it means that the most recent changes of the Xling PCB will find their way into current/3.0 branch of the repository.

    Note that it has nothing in common with the firmware version of Xling. The most recent changes in code find their way into current/0.4 branch of the Xling-firmware repository

    Animation demo

    Anyway, I'd like to show you a walking animation demo at 24 FPS. There are only 4 images of the animation where each one stays on a screen during two frames.

    However, a driver for SH1106-based displays I've been working on can do its best and produce the same animation at full speed:

    You're probably interested in the technical information on the screen. Here it is:

    1. BAT_LVL - a raw ADC value of the battery voltage (voltage divider, ADC3, 10-bit, Vref = 1.1 V).
    2. BAT_STAT - a single bit, which is grabbed directly from the MCP73831 STAT pin (1 - when the battery current, Ibat, is below a selected threshold, Iterm, 0 - otherwise).
    3. Number of frames to re-draw before calculating a delay.
    4. Time spent to re-draw the frames.
    5. Current FPS (according to 3 and 4).

    More PCB checkpoints and 4-wire SPI


    Spending time debugging and optimizing the OLED driver, I've realised that it would be convinient to have additional test points on top of the PCB. It's now possible to solder wires and attach the oscilloscope probes easily, without turning the bottom part of the PCB into a mess.

    Another change is 4-wire SPI which is used to connect the display in v3.1. I've decided to give up with the 3-wire SPI support in the driver entierly because of the 8-bit SPI shift register available in ATmega1284P only.

    There is no room for the 9th bit required by the display controller to distinct between data for graphics RAM and command register. Moreover, there is no easy way to stop transmitting bits from the shift register to "hack" the protocol.

    FreeRTOS-based firmware

    This is probably the most interesting update of mine.

    I've got a demo project (FreeRTOS/Demo/AVR_ATMega323_WinAVR) of FreeRTOS v10.2.1, copied several files (including list.c, queue.c, tasks.c, croutine.c and port.c + headers) to the Xling-firmware project and adjusted CMake configuration file according to the makefile from the demo project.

    Another modification is the port.c file which has been re-programmed a bit in order to use a 16-bit Timer/Counter 1 of the ATmega1284P to generate ticks for the FreeRTOS scheduler.

    So, it means that I can do something like that from now on :)

    Other updates

    Personally, I'd like to thank the community of r/PrintedCircuitBoard and u/charliebruce123 in particular because they pointed me to the issues with the previous version of the PCB. I've tried to fix them all in v3.1.

    Xling v3.1 isn't the first PCB version which has been attached to the battery in order to check how load-sharing circuit works, but it is the first one which allowed me to measure a battery voltage obtained from ADC via a voltage divider, a direct battery voltage, an output voltage at +3.3V and a battery status pin.

    All of the information should be enough to program a task which monitors the battery status correctly and prevents overcharges and deep discharges.

    Anyway, if you have any questions and ideas on your mind, feel free to tell me then.

    Have a good time!


  • Xling v0.3 - an artistic PCB, ATmega1284P and white OLED with SPI

    dsl10/05/2019 at 18:45 2 comments

    The whole summer has passed and I've finally finished the next version of the toy according to my plan. There are several significant changes which you've probably noticed:


    The first one doesn't carry any technical function, but provides a unique look and feel of the PCB (many thanks to SierraSaura for this picture).


    The second change is a new ATmega1284P MCU which replaces the previous ATmega328P one.

    It is the most important improvement over the previous versions because of the 32 KiB -> 128 KiB flash memory (the only memory on the board to carry a lot of the graphic sprites, for example). An amount of RAM has also been increased from 2 KiB on ATmega328P to 16 KiB on ATmega1284P.


    The third change is almost the same OLED display which color is white now instead of the yellow on the previous prototypes and connected using SPI.

    All of the previous displays with SH1106 controller were connected via two-wire interface (TWI, another name for I2C) which is relatively slow comparing to the SPI.

    However, a driver for the SH1106-based displays I'm working on doesn't support SPI yet. This is the next step on my way and this new Xling v0.3 will help me testing it.


    Anyway, if you have any questions and ideas on your mind, feel free to tell me then.

    Have a good time!

  • Actual size (height)

    dsl05/24/2019 at 18:45 0 comments

  • Actual size (width)

    dsl05/24/2019 at 18:38 0 comments

View all 6 project logs

Enjoy this project?

Share

Discussions

Jacob MacLeod wrote 10/13/2019 at 20:55 point

Nice project!

  Are you sure? yes | no

dsl wrote 10/14/2019 at 06:00 point

Thanks :)

  Are you sure? yes | no

Tom Nardi wrote 10/11/2019 at 03:07 point

Love the Disenchantment reference, very impressive project.

  Are you sure? yes | no

dsl wrote 10/11/2019 at 07:53 point

Ah, you've noticed it! Thanks :)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates