Feed on
Posts
Comments

This is a long delayed post. I am glad I finally finished making a video for it, and it’s time to introduce SquareWear 2.0 — an open-source, wearable Arduino microcontroller board. At heart, SqureWear 2.0 is an Arduino running at 3.3V and 12MHz. It has built-in mini-USB port for uploading programs, charging lithium batteries, and creating a serial communication channel. It comes with a lot of useful built-in components, such as a color LED, a general-purpose push-button, a buzzer (yup, you can make it sing a tune), light sensor, temperature sensor, three MOSFETs (to drive high-current load). Even better, it has a built-in rechargeable lithium coin battery (you heard it right: rechargeable coin battery!), so you can power your project right away without requiring external power supply. Every time you plug in the mini-USB cable, it charges the coin battery automatically. Better still, if you want a beefier battery, you can plug in an external lithium battery through the on-board battery jack. The built-in lithium charger can charge external battery as well. Overall SquareWear 2.0 packs a lot of useful features on a 1.7″ x 1.7″ board. It’s great for wearable electronic projects as well as general-purpose microcontroller projects. Below is a summary of built-in components:

  • ATmega328 running at 3.3V, 12MHz.
  • MCP1700 3.3V / 250mA LOD.
  • MCP73831 lithium charging chip (configured to charge at 35mA).
  • MCP9700 temperature sensor.
  • 10K photo-resistor.
  • Four 2N7002 MOSFETs.
  • 5050 color LED.
  • 8.5mm SMT buzzer.
  • 6mm SMT tactile button.
  • Charging indicator LED.
  • LIR2032 rechargeable lithium coin battery (45mAh capacity).
  • 2.0mm JST connector for external lithium battery.
  • SMT mini-USB port, and power switch.

IMG_2856IMG_2861IMG_2858

squarewear2_annotation

Last year around this time I released SqureWear 1.1, which is based on Microchip’s 18F14K50 microcontroller. It’s pretty neat, but over time I’ve received quite a few requests to develop a similar board based on the Arduino. This inspired me to work on SquareWear 2.0. Many design choices, including components I selected to put on board, were based on feedback and experience at various wearable electronics workshops I organized.

With SquareWear 2.0, programming is now done through the Arduino software. You can make use of thousands of available Arduino libraries to help build your project. Similar to the standard Arduino, it is based on a ATmega328 microcontroller. However, SquareWear does not have a separate USB-to-serial chip. Instead, it simulates USB functionality all in software, using the V-USB library. It has a USBasp bootloader, and can perform serial communication through USB. It can also simulate a mouse, a keyboard, or other human interface devices (see V-USB example projects). While software-based USB is not that fast, it really helps reduce the cost and size of the board by having one chip to carry out all the tasks. That’s why we can offer SquareWear 2.0, with all the aforementioned components and features, at a very competitive price.

The bootloader is based on Frank Zhao’s USnoobie project. To enter programming mode, press and hole the on-board tactile button, then turn on power. This will allow the microcontroller to bootload as a USBasp programmer, which is supported by Arduino. On Linux and Mac, you don’t need to install any driver; on Windows, you need to install the USBasp driver (come on, Microsoft!), which is included in the SqureWear software package. The board has internal assignments for the following pins:

  • D2/D7: USB D-/D+.
  • D4: tactile button.
  • D8/D12/D13: LED red/green/blue channel.
  • D9: buzzer.
  • A0/A1: light/temperature sensor.

The other pins are all mapped out to sewable pin pads with large holes. You can either stitch conductive threads through the pins, or solder wires directly onto the pins, or solder snaps to make it easy for quickly attaching or detaching the board from fabric.

IMG_2859IMG_2860

I should mention that pins D3, D5, D6 are internally connected to n-channel MOSFETs and these pins are suitable for driving high-current load (up to 250mA each pin). This is very useful if you want to switch a large number of parallel LEDs, a motor, a muscle wire, a heat wire etc. You can even combine two or three of them together to drive higher current. If you are familiar with Arduino, you should know that these three pins also support hardware PWM, so you can use them to control the brightness of LEDs, the speed of a motor etc. Technically I call them ‘power sink pins’ because unlike a standard output pin, they can only connect or disconnect a component from ground (sink). So the right way to use them is by connecting the positive wire of your component to Vcc (or external power), and the negative wire to one of the MOSFET pins.

Anyways, I want to keep this post short, so I will leave you to find more details in the video tutorial above, and the user manual in the software package. If you are interested in buying SquareWear 2.0, it’s available for purchase at the Rayshobby Shop. Feel free to leave comments below, or on the forum. Thanks!

23 Responses to “Introducing SquareWear 2.0 — An Open-Source Wearable Arduino”

  1. Nikita says:

    How much RAM is installed and available for a program to use?

    • ray says:

      ATmega328 has 32KB flash memory space (among which 4KB is used for bootloader), 2KB RAM, and 1KB EEPROM. So the available flash memory is 28KB.

      • Xark says:

        Actually, I believe ATmega328 has 2KB of internal SRAM (not 1KB). This is easily verified on Atmel site or Wikipeda ATmega328 entry.

      • ray says:

        You are right, it has 2KB SRAM (the EEPROM size is 1KB). Also, the bootloader actually takes 4KB, so I corrected my reply above. It’s possible to get the bootloader down to 2KB using particular versions of avr-gcc.

  2. Chris says:

    Does the board provide a deep-discharge-protection for the LiIon / LiPo battery?

    • ray says:

      The MCP73831 LiPo charger supports trickle charging for deeply discharged LiPo battery. But if you are referring to something like short-circuit protection for the battery, there is no particular circuitry to prevent deep discharging. The MCP1700 LDO outputs a maximum of 250mA on the Vcc line, so in the event of a short circuit, it’s unlikely you will be able to draw more than 250mA. Many LiPo batteries (such as the one we carry in store: http://rayshobby.net/cart/accessories/acc-batteries/lipo-700) has built-in circuit for over-voltage, under-voltage, and over-current protection.

      • Chris says:

        Thank you for your reply! I have one more question does the coin cell also have a under voltage protection or is deep discharge no issue with these cells?

      • ray says:

        Sorry for my delayed reply: there is no under voltage protection for deep discharging. A 2.7V brown-out voltage is set on the microcontroller so the microcontroller will not start when voltage drops below 2.7V. But this won’t prevent short circuits from draining the battery.

  3. mlinaje says:

    Hi Ray,
    What do you think is the best suitable option to connect it wirelessly (Bluetooth or Wi-Fi)?
    Due to the advanced USB squearewear support: Should it be possible to use a Wi-Fi or BT Dongle through the V-USB library?
    Thanks in advance.
    P.D.: For our projects wireless connectivity is a must. So, to use squearewear to prototype we should need to connect it wiressly to a router/hub.
    Best Regards and the best for the new year. The squarewear looks incredible!

    • ray says:

      To interface with USB dongles you need a microcontroller that can serve as USB hosts. This is not something an Arduino microcontroller can handle. You may want to consider bluetooth and WiFi modules (for example, Adafruit has these modules) which can interface with a microcontroller through SPI or serial.

      • mlinaje says:

        Thanks Ray. Any project out there showing how to do it? (we have already used BT modules with Arduino).
        Best Regards,

      • ray says:

        SquareWear 2.0 itself is an Arduino, just with a different form factor. If you can use BT modules with Arduino, you should be able to use it with SquareWear the same way.

  4. fungus says:

    I really like this. At first I was like, “Oh, not another one” but after I watched the video I was more “I want one!”.

    One question: What’s the nominal power consumption? How long does the battery last in basic use (ie. not powering lots of external devices)? Can it go into a microamp-sleep (with watchdog wakup) to save power?

  5. amarkson says:

    What are your thoughts in the ability to lower the power draw? Would including JeeLib in my sketch lower the overall draw? (As outlined here : http://www.openhomeautomation.net/arduino-battery/)

    • ray says:

      The most effective way is to put the microcontroller to sleep most of the time, and wake it up periodically to perform tasks. In the SquareWear 2.0 software package, there is a ‘music_box’ demo which makes use of watchdog timer interrupt to implement the above idea. Please take a look at it.

  6. mkjunior says:

    Hi ,i am having problems after downloading files.brd says it is corrupt and wont open.Png will load up but says it is corrupt after downloading it.

    • ray says:

      How are you trying to download? You can’t use ‘Save Link As’ or ‘Save File As’, you need to either download the whole repository as a zip (https://github.com/rayshobby/squarewear/archive/master.zip) or download individual files using the ‘Raw’ link.

      • mkjunior says:

        Yo.thanks a lot man.I have another question.If i printed this out only the top layer, would it still work ? i was thinking probably the bottom traces are to do with the touch.Pardon my asking noobquestions.I am a biology person whos into electronics !

      • ray says:

        Nope, you need both the top and bottom layers.

      • mkjunior says:

        thanks man.I will try to toner transfer this and see if i can get it to work.Wonderful project though man!

      • ray says:

        Well, I should warn you that it will be very tricky to use tone transfer for double-sided PCBs. Also, the SquareWear PCB traces are very thin, so it will be quite challenging.

Leave a Reply