https://badge.emfcamp.org/w/api.php?action=feedcontributions&user=Raj&feedformat=atomEMF Badge - User contributions [en]2024-03-28T21:41:23ZUser contributionsMediaWiki 1.35.5https://badge.emfcamp.org/w/index.php?title=TiLDA_MK4&diff=482TiLDA MK42024-03-28T09:55:40Z<p>Raj: </p>
<hr />
<div>[[File:TiLDA_Mk4_Front_with_sponsors.png|right|500px|TiLDA Mkšæ]]<br />
<br />
== Using your badge ==<br />
<br />
<div style="background-color: #FFFFDD; border: 1px solid #808000; padding: 5px;"><strong>If you just got your badge and it doesn't do anything</strong>, don't despair, quite a few of them need to be [[TiLDA_MK4/reset|factory reset]] before showing the loading screen. Press and hold <code>MENU</code> while quickly pressing the reset button at the back. Keep the <code>MENU</code> button hold for another 2 seconds. Release it when both the red and green LED are lit. If you got it correct both LEDs should flash a few times.<br>If this doesn't work you can [[TiLDA_MK4/Firmware_Update|update the badge firmware]]. If this doesn't work, please come and join us in #emfcamp-badge on [https://libera.chat/ Libera IRC]</div><br />
<br />
=== Updating your badge firmware ===<br />
After (and during!) EMF the badge firmware was substantially fixed and improved, resolving issues with call handling and apps.<br />
<br />
Please update your badge firmware as soon as possible. You can find [[TiLDA_MK4/Firmware_Update|documentation on this here]].<br />
<br />
=== Assembly ===<br />
With your badge you will receive a booklet explaining how it's done. If you have any problems, please come to the Badge Operation Center and we will help you.<br><br />
Booklet can be found [https://archive.org/details/emf2018_badge_guide here]<br />
<br />
=== Basic usage ===<br />
After you have assembled your badge you can just use the tiny switch at the bottom of the screen to turn your badge on. Alternatively you can use any USB power source. If you turn your badge on for the first time (or if for some reason it has reset itself) you will get some on-screen information while we try to download the newest set of software. '''This doesn't always work on the first try, you might have to use "reset" to try a few times'''<br />
<br />
If at any point you want to restart your badge you can just press the reset button on the back below the display ribbon. <br />
<br />
==== Changing your name ====<br />
<br />
# Press 'Menu'<br />
# Select the 'Settings" app<br />
# "Change Name" and press 'A'<br />
# Use the joystick and 'A' key to enter your name<br />
# Press 'Menu' to save your name and reset the badge - your name should now be displayed!<br />
<br />
==== Installing new apps ====<br />
<br />
# Press 'Menu'<br />
# Select 'Badge Store' app and press 'A'<br />
# Select "Install"<br />
# Select a category and then an app. Wait until you see the description and press "A" to save it.<br />
# Press B a few times (or alternatively MENU) to restart your badge<br />
# On the home screen you can now press MENU to find your newly installed app.<br />
<br />
=== WiFi ===<br />
Your TiLDA Badge has built-in wifi support. It should all just work if you're at the campsite, but if you're on your own network you might have to tell the badge about it. For more information please have a look here: [[TiLDA MK4/wifi|WiFi]]<br />
<br />
=== Charging ===<br />
The badge charges via a microUSB socket, and takes about 2-3 hours for a full charge. The red charge LED to the right of the display ribbon on the back will extinguish when charging is complete.<br />
<br />
=== Calling and SMS ===<br />
<br />
'''Warning: The badge team are aware of an issue of instability while using the calling capability. Please bear with us while we diagnose this.'''<br />
<br />
Yes your TiLDA Badge is also a mobile phone. To connect to the EMF mobile network insert the Hologram SIM supplied, load the "phone" app, select "Select Operator", wait, wait some more, and a little longer, then select "EMF" or "23404". Select "Auto" to use a public mobile network again.<br />
<br />
To find out your number on the EMF network select "Information" in the phone app. If "Operator" is not shown on the information screen then you have failed to connect to the network. If you are not given a number then wait a little longer and try again. You can read and send SMS messages with the "sms" app. You can also answer calls by pressing "Call" in any app, and end or reject a call using the "End" button at any time.<br />
<br />
<Radiocode> The cellular part of the badge seems to work (reliably) perfectly if an external antenna is used, such as a mag-mount with a length of coax. Seems to be an EMC issue, as using the pictured right angle antenna directly on the SMA does not work reliably. Time to get the Kapton tape and copper foil out...<br />
<br />
[[File:GSM Antenna.jpg]]<br />
<br />
=== Connecting over USB ===<br />
By default, the software is in a loop. If you want to interact over the REPL you need to exit this. The easiest way is to press Ctrl-C.<br />
<br />
It's hard to press Ctrl-C in minicom, so on Linux this is easier to do with screen:<br />
<pre><br />
screen /dev/ttyACM0 115200<br />
</pre><br />
<br />
If you can connect but Ctrl-C has no effect then it is possible that another service on your machine is accessing the tty before you can connect. A likely candidate is modemmanager. You can check if ModemManager is running using:<br />
<br />
<pre><br />
systemctl | grep -i modem<br />
</pre><br />
<br />
and can be stopped with:<br />
<br />
<pre><br />
systemctl stop ModemManager.service<br />
</pre><br />
<br />
On Mac:<br />
<pre><br />
screen /dev/tty.usbmodemTiLDA2<br />
</pre><br />
<br />
To exit screen, press Ctrl-A, then k, then y.<br />
<br />
On Windows:<br />
# If you don't have PuTTY or a similar program, get PuTTY installer from [https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html]<br />
# Open PuTTY and select Serial connection<br />
# Change COM1 to the COM port for your badge (You can usually find this as USB Seiral Port under ports in device manager)<br />
<font color="#606060"><i>Note: if your badge resets while putty is open, you will have to close the window and open a new connection to the same COM port.</i></font><br />
<br />
The basic process is this:<br />
<br />
# Connect device to computer with usb<br />
# Fire up minicom or screen<br />
# Press reset button on device<br />
# Hit Ctrl+C quickly and with vigour to get to the REPL before the UI comes up<br />
<br />
=== Nothing works! Help! ===<br />
<br />
Don't worry, you can always "factory reset" your badge. Please follow these instructions: [[TiLDA_MK4/reset|Resetting]]<br />
<br />
If everything else absolutely fails, you can try following these instructions (advanced): [[TiLDA_MK4/Firmware_Update]]<br />
<br />
== Hacking your badge ==<br />
<br />
=== App Hack ===<br />
<br />
'''[https://gist.github.com/SteveAmor/8c333927fded2339da54ad4aaa765d7e A method to hack your app onto your badge]'''<br />
<br />
=== Tilda Tools ===<br />
<br />
<br />
'''[[TiLDA_MK4/tilda-tools|tilda-tools]]''' - Should now work on Windows, Linux and OSX<br />
<br />
=== OSX ===<br />
<br />
Mass storage now works on OSX<br />
<br />
<br />
'''[[TiLDA_MK4/Introduction_to_badge_hacking|Badge Hacking Workshop Documentation]]'''<br />
<br />
<br />
One of the main goals of TiLDA is to make hacking it as easy as possible. All you need to do so is a computer with USB and your badge.<br />
<br />
* '''[[TiLDA_MK4/tilda-tools|tilda-tools]]''' - the one-stop interface for all your badge needs<br />
* '''[[TiLDA MK4/Get Started|Step-by-step]]''' - to make it as easy as possible to get going<br />
* '''[[TiLDA MK4/Run Code|3 Ways to run code on your TiLDA]]'''<br />
* '''[[TiLDA MK4/Badge Store Submissions|Badge Store Submissions]]''' - Share your creations with others<br />
* '''[[TiLDA MK4/Code Structure|Code Structure]]''' - How the python code is structured<br />
<br />
The badge itself runs code written in the computer language [https://en.wikipedia.org/wiki/Python_(programming_language) Python] which is run by a bit of software called [https://micropython.org/ Micropython]. <br />
<br />
For more information about the functions available please have a look at the [[#Badge API|Badge API]] section of this page.<br />
<br />
In case you're more interested in what makes the hardware tick and your confident with C++ and microprocessors then you can work directly with the micropython code that runs TiLDA: [[TiLDA MK4/build|How to build the firmware from scratch]]<br />
<br />
All code used is hosted on Github. Contributions and PR are very welcome!<br />
* https://github.com/emfcamp/Mk4-Apps<br />
* https://github.com/emfcamp/Mk4-Backend (powers the badge store)<br />
* https://github.com/emfcamp/Mk4-micropython-board<br />
<br />
=== Building Micropython Firmware ===<br />
[[TiLDA_MK4/BuildingFirmware|Build Instructions]]<br />
<br />
=== Some ideas ===<br />
<br />
[[TiLDA MK4/Ideas|Please share what you've done (or want to do) with others!]]<br />
<br />
Tips by Ben Woodley (Tested on Ubuntu 18.04 and Debian Stretch)<br />
<br />
'''If you're having issues with getting the python prompt while using a serial terminal or the tilda_tools is failing'''<br />
Error displayed: SerialTimeoutException: Write Timeout<br />
Fix: <br />
* Do this command (ModemManager steals your escape characters!)<br />
* $ sudo systemctl stop ModemManager.service<br />
* Then make sure your badge is in an app (anything but the purple home screen)<br />
* Try open a serial terminal with the device (e.g. screen /dev/ttyACM0 115200)<br />
* The issue should not persist<br />
<br />
'''Reflash the firmware'''<br />
* If lets say you wanted to '''force a firmware update to apply the patch for making phone calls''' then just follow these steps.<br />
* $ git clone https://github.com/micropython/micropython.git<br />
* $ cd micropython/ports<br />
* $ git clone https://github.com/emfcamp/Mk4-micropython-board.git<br />
* $ cd Mk4-micropython-board<br />
* $ ./inst_tools<br />
* $ make<br />
* You may need additional packages depending on your distro, follow the errors if encountered with inst_tools or make.<br />
* Put the badge in DFU mode (press and hold the centre button of the joystick and press reset button, let go of joystick after a second)<br />
* $ make flash-dfu<br />
* This will reflash the firmware, if it fails your board is either not in dfu mode or you need additional packages (like python3-serial in apt!)<br />
<br />
'''Using the Grove Serial connector'''<br />
<br />
<Radiocode><br />
The Badge Team thoughtfully chose to include a couple of Seeed Studio Grove system connectors to the 2018 badge. Looking at the rear of the badge, <br />
they are either side of the unpopulated 3.5mm jack footprint, top right. <br />
*On the left is the Grove I2C connector <anyone using this?><br />
*On the right is the Grove UART connector<br />
The Grove UART is helpfully labelled "UART4". To use it in Python, it is actually number 2!!!<br />
<br />
Example: <br />
<br />
import machine<br />
<br />
u = machine.UART(2, 9600) <br />
<br />
g = u.readline()<br />
<br />
etc...<br />
<br />
can be used to communicate with the Seeed Studio GPS module. [Seeed Studio: http://wiki.seeedstudio.com/Grove-GPS/]<br />
<br />
== Badge API ==<br />
<br />
=== Build-in ===<br />
* [http://docs.micropython.org/en/latest/pyboard/ documentation] - General Micropython libarary<br />
* [[TiLDA MK4/ugfx|uGFX]] - The TiLDA LCD colour screen<br />
* [[TiLDA MK4/documentation/cc3100|CC3100]] - The wifi chip<br />
* [[TiLDA MK4/rtc|RTC]] (real time clock)<br />
* [[TiLDA MK4/sensors|Sensors]]<br />
* [[TiLDA MK4/sim800|SIM800]] (GSM/Phone/Bluetooth)<br />
* [[TiLDA MK4/modtilda|import tilda]] (our custom micropython module)<br />
* [[TiLDA MK4/spi|SPI]] SPI<br />
* [[TiLDA MK4/Neopix|Neopix]] WS2812B LEDs<br />
* please add<br />
<br />
=== TiLDA Libraries ===<br />
On top of the build-in modules above we have also created a bunch of helpful libraries written in python. If you go through the bootstrap process or use the App Library you should always have a full set of those on your badge. If for some reason this isn't the case you can download our repository from https://github.com/emfcamp/Mk4-Firmware and copy the <code>lib</code> folder onto your badge.<br />
<br />
for now please have a look at the libraries themselves: https://github.com/emfcamp/Mk4-Apps/tree/master/lib<br />
<br />
(feel free to add additional ideas, and create links new wiki pages to on-going projects, perhaps someone will want to contribute)<br />
<br />
=== Hardware ===<br />
<br />
Full hardware files are on GitHub [https://github.com/emfcamp/Mk4-Hardware]<br />
<br />
== Badge hardware ==<br />
<br />
TiLDA comes with a long list of very useful hardware. Some might be obvious, but some are a bit hidden. <br />
* Texas Instruments [http://www.ti.com/product/MSP432E401Y MSP432E4 SimpleLink Microcontroller] (ARM Cortex-M4F @ 120MHz)<br />
* Texas Instruments [http://www.ti.com/product/CC3120 CC3120 SimpleLink Wi-FiĀ® Network Processor]<br />
* 256KB internal RAM / 8MB external SDRAM<br />
* 1MB internal flash (firmware) / 1MB external flash (filesystem)<br />
* [https://simcom.ee/modules/gsm-gprs/sim800c/ SIM800 Quad-band GSM/GPRS module] with Bluetooth support<br />
* [https://cdn.hackaday.io/files/11178478239552/ER-TFT024-3_Datasheet.pdf 240x320 RGB screen]<br />
* 2 [https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf WS2812B RGB LEDs] (aka Neopixels) with a 3-pin header to connect your own (And this year theyāre the right way up!)<br />
* Texas Instruments [http://www.ti.com/lit/ds/symlink/hdc2080.pdf HDC2080 Low Power Humidity and Temperature Sensor]<br />
* Texas Instruments [http://www.ti.com/lit/ds/symlink/tmp102.pdf TMP102 Digital Temperature Sensor]<br />
* Texas Instruments [http://www.ti.com/lit/ds/symlink/opt3001.pdf OPT3001 Digital Ambient Light Sensor]<br />
* Texas Instruments [http://www.ti.com/lit/ds/symlink/drv5055.pdf DRV5055 High Accuracy Bipolar Hall Effect Sensor]<br />
* Speaker and Microphone<br />
* 2000mAh Battery<br />
* Onboard Ethernet (requires breakout)<br />
* A [https://en.wikipedia.org/wiki/T9_(predictive_text) T9] number keypad and a joystick<br />
* 2 [http://wiki.seeedstudio.com/Grove_System/ Seed Studio Grove headers] (one UART, one IĀ²C)<br />
* [https://learn.sparkfun.com/tutorials/sewing-with-conductive-thread Conductive thread] points and 0.1" header for power/UART/I2C/GPIO<br />
* [https://hackaday.io/project/52950-defcon-26-shitty-add-ons Defcon 26 Shitty Add-Ons connector]<br />
<br />
Hardware files are available on GitHub [https://github.com/emfcamp/Mk4-Hardware].<br />
<br />
[[File:Sensor_graphic_-_with_fixed_transparency-01.png|left|500px|TiLDA Mkšæ Back]]<br />
[[File:Sensor_graphic_-_with_fixed_transparency-02.png|left|500px|TiLDA Mkšæ Back]]<br />
[[Category: Badges]]</div>Rajhttps://badge.emfcamp.org/w/index.php?title=TiLDA_MK3/build&diff=269TiLDA MK3/build2017-08-25T22:30:56Z<p>Raj: /* USB Permissioning on Linux */ - spelling error</p>
<hr />
<div>== Dependencies ==<br />
<br />
You can use either windows or linux, although windows will not have most things installed by default<br />
<br />
=== git, make, python, etc ===<br />
I will just assume you have this<br />
<br />
=== arm-none-eabi-gcc ===<br />
https://launchpad.net/gcc-arm-embedded/+download<br />
You will have to make the arm-none-eabi-gcc from the bin directory available to your system (add to PATH, symlink or copy)<br />
<br />
On Ubuntu you can follow these instructions: https://launchpad.net/~team-gcc-arm-embedded/+archive/ubuntu/ppa<br />
<br />
On Debian (in Stretch, maybe earlier versions too, also Raspbian Jessie) you can `sudo apt-get install gcc-arm-none-eabi`<br />
<br />
=== pyusb===<br />
<pre>sudo pip install pyusb</pre><br />
<br />
== USB Permissioning on Linux ==<br />
<br />
On some Linux distributions it may be necessary to add additional udev rules in order to allow the REPL to work:<br />
<br />
copy the following text to /etc/udev/rules.d/49-tilda-mk3.rules<br />
<br />
<pre><br />
# 0483:df11 - Tilda Mk3 based on Micropython board<br />
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", ENV{ID_MM_DEVICE_IGNORE}="1"<br />
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", ENV{MTP_NO_PROBE}="1"<br />
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666"<br />
KERNEL=="ttyACM*", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666"<br />
</pre><br />
<br />
And then restart the udev service:<br />
<br />
<pre><br />
sudo udevadm control --reload-rules<br />
</pre><br />
<br />
== Flashing ==<br />
<br />
<pre><br />
# Clone this repo<br />
git clone --recursive https://github.com/emfcamp/micropython.git <br />
<br />
# Switch to our work branch<br />
cd micropython<br />
git checkout tilda-master<br />
<br />
# Now we can build the firmware and flash it to the badge<br />
# You have to boot the badge into dfu mode by pressing down the center<br />
# joystick button while pressing the reset button to trigger a reboot<br />
make -C stmhal BOARD=STM32L475_EMFBADGE deploy<br />
</pre><br />
<br />
== What to do when the firmware update.py script fails ==<br />
<br />
When attempting an update from linux, some users have hit timeouts during hte mass_erase step. This leaves the badge in an ususable state.<br />
<br />
<pre><br />
$ python update.py <br />
Hello - Welcome to the automated TiLDA firmware updater<br />
We found your badge. So far, so good...<br />
Traceback (most recent call last):<br />
File "update.py", line 556, in <module><br />
main()<br />
File "update.py", line 530, in main<br />
mass_erase()<br />
File "update.py", line 114, in mass_erase<br />
"\x41", __TIMEOUT)<br />
File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 1043, in ctrl_transfer<br />
self.__get_timeout(timeout))<br />
File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 883, in ctrl_transfer<br />
timeout))<br />
File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 595, in _check<br />
raise USBError(_strerror(ret), ret, _libusb_errno[ret])<br />
usb.core.USBError: [Errno 110] Operation timed out<br />
</pre><br />
<br />
If you have access to a Windows PC, you can download the STMicroelectronics DfuSe USB device firmware updater software http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stsw-stm32080.html and use the 'Upgrade or Verify Action' part of the GUI to update the firmware instead. <br />
<br />
* Install the STMMicroelectronics util from the link above.<br />
* Download the firmware.dfu file from https://update.badge.emfcamp.org/firmware.dfu and save it off.<br />
* Start up DfuSeDemo.exe, and click the 'Choose' button - select the firmware.dfu file and then hit 'Upgrade'<br />
* Your badge should now be un-bricked</div>Rajhttps://badge.emfcamp.org/w/index.php?title=TiLDA_MK3/build&diff=268TiLDA MK3/build2017-08-25T22:24:54Z<p>Raj: /* USB Permissioning on Linux */ - spelling error</p>
<hr />
<div>== Dependencies ==<br />
<br />
You can use either windows or linux, although windows will not have most things installed by default<br />
<br />
=== git, make, python, etc ===<br />
I will just assume you have this<br />
<br />
=== arm-none-eabi-gcc ===<br />
https://launchpad.net/gcc-arm-embedded/+download<br />
You will have to make the arm-none-eabi-gcc from the bin directory available to your system (add to PATH, symlink or copy)<br />
<br />
On Ubuntu you can follow these instructions: https://launchpad.net/~team-gcc-arm-embedded/+archive/ubuntu/ppa<br />
<br />
On Debian (in Stretch, maybe earlier versions too, also Raspbian Jessie) you can `sudo apt-get install gcc-arm-none-eabi`<br />
<br />
=== pyusb===<br />
<pre>sudo pip install pyusb</pre><br />
<br />
== USB Permissioning on Linux ==<br />
<br />
On some Linux distributions it may be necessary to add additional udev rules in order to allow the REPL to work:<br />
<br />
copy the following text to /etc/udev/rules.d/49-tilda-mk3.rules<br />
<br />
<pre><br />
# 0483:df11 - Tila Mk3 based on Micropython board<br />
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", ENV{ID_MM_DEVICE_IGNORE}="1"<br />
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", ENV{MTP_NO_PROBE}="1"<br />
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666"<br />
KERNEL=="ttyACM*", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666"<br />
</pre><br />
<br />
And then restart the udev service:<br />
<br />
<pre><br />
sudo udevadm control --reload-rules<br />
</pre><br />
<br />
== Flashing ==<br />
<br />
<pre><br />
# Clone this repo<br />
git clone --recursive https://github.com/emfcamp/micropython.git <br />
<br />
# Switch to our work branch<br />
cd micropython<br />
git checkout tilda-master<br />
<br />
# Now we can build the firmware and flash it to the badge<br />
# You have to boot the badge into dfu mode by pressing down the center<br />
# joystick button while pressing the reset button to trigger a reboot<br />
make -C stmhal BOARD=STM32L475_EMFBADGE deploy<br />
</pre><br />
<br />
== What to do when the firmware update.py script fails ==<br />
<br />
When attempting an update from linux, some users have hit timeouts during hte mass_erase step. This leaves the badge in an ususable state.<br />
<br />
<pre><br />
$ python update.py <br />
Hello - Welcome to the automated TiLDA firmware updater<br />
We found your badge. So far, so good...<br />
Traceback (most recent call last):<br />
File "update.py", line 556, in <module><br />
main()<br />
File "update.py", line 530, in main<br />
mass_erase()<br />
File "update.py", line 114, in mass_erase<br />
"\x41", __TIMEOUT)<br />
File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 1043, in ctrl_transfer<br />
self.__get_timeout(timeout))<br />
File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 883, in ctrl_transfer<br />
timeout))<br />
File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 595, in _check<br />
raise USBError(_strerror(ret), ret, _libusb_errno[ret])<br />
usb.core.USBError: [Errno 110] Operation timed out<br />
</pre><br />
<br />
If you have access to a Windows PC, you can download the STMicroelectronics DfuSe USB device firmware updater software http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stsw-stm32080.html and use the 'Upgrade or Verify Action' part of the GUI to update the firmware instead. <br />
<br />
* Install the STMMicroelectronics util from the link above.<br />
* Download the firmware.dfu file from https://update.badge.emfcamp.org/firmware.dfu and save it off.<br />
* Start up DfuSeDemo.exe, and click the 'Choose' button - select the firmware.dfu file and then hit 'Upgrade'<br />
* Your badge should now be un-bricked</div>Rajhttps://badge.emfcamp.org/w/index.php?title=TiLDA_MK3&diff=215TiLDA MK32016-08-09T21:57:38Z<p>Raj: /* TiLDA Libraries */</p>
<hr />
<div>[[File:TiLDA_MK3_front.jpg|right|500px|TiLDA MkĻ]]<br />
<br />
== Using your badge ==<br />
<br />
<div style="background-color: #FFFFDD; border: 1px solid #808000; padding: 5px;"><strong>If you just got your badge and it doesn't do anything</strong>, don't despair, quite a few of them need to be [[TiLDA_MK3/reset|factory reset]] before showing the loading screen. Press and hold <code>MENU</code> while quickly pressing the reset button at the back. Keep the <code>MENU</code> button hold for another 2 seconds while the green light on the front is blinking. Release it <i>while</i> the green light is on.<br>If this doesn't work you can [[TiLDA_MK3/Firmware_Update|update the badge firmware]]. If this doesn't work, please come and join us in #tilda on [https://freenode.net/ Freenode IRC]</div><br />
<br />
<br />
<div style="background-color: #DDFFFF; border: 1px solid #808000; padding: 5px;">If you're having problems downloading some apps from the App Library <b>please update your badge via the App Library update option</b>. After a restart it should work much smoother.</div><br />
<br />
=== Assembly ===<br />
With your badge you will receive a booklet explaining how it's done. If you have any problems, please come to the Badge Operation Center and we will help you.<br />
<br />
=== Basic usage ===<br />
After you have assembled your badge you can just use the tiny switch at the bottom of the screen to turn your badge on. Alternatively you can use any USB power source. If you turn your badge on for the first time (or if for some reason it has reset itself) you will get some on-screen information while we try to download the newest set of software. <br />
<br />
If at any point you want to restart your badge you can just press the reset button at the back. <br />
<br />
==== Changing your name ====<br />
<br />
# Press 'Menu'<br />
# Select the 'Change Name' app and press 'A'<br />
# Use the joystick and 'A' key to enter your name<br />
# Press 'Menu' to save your name and reset the badge - your name should now be displayed!<br />
<br />
==== Installing new apps ====<br />
<br />
# Press 'Menu'<br />
# Select the 'App Library' app and press 'A'<br />
# Select "Browse App Store"<br />
# Select a category and then an app. Wait until you see the description and press "A" to save it.<br />
# Press B a few times (or alternatively MENU) to restart your badge<br />
# On the home screen you can now press MENU and select "View all" to find your newly installed app. If you want to pin it to the quick launcher screen select your app and press MENU. If you just want to start it press A instead.<br />
<br />
=== WiFi ===<br />
Your TiLDA Badge has built-in wifi support. It should all just work if you're at the campsite, but if you're on your own network you might have to tell the badge about it. For more information please have a look here: [[TiLDA MK3/wifi|WiFi]]<br />
<br />
<strong>A word of warning</strong>: During EMF the badge will use "emf-insecure". This is, as the name implies, not the most secure way of transmitting data. On top of that there are some problems with HTTPS and SSL, so we're not using it for with the default apps (we're working on it!). Please <span style="color:red">don't send anything private or important to or from the badge via wifi</span>.<br />
<br />
=== Charging ===<br />
The badge charges via a microUSB socket, and takes about 2-3 hours for a full charge. The red charge LED next to the USB connector will extinguish when charging is complete<br />
<br />
=== Nothing works! Help! ===<br />
<br />
Don't worry, you can always "factory reset" your badge. Please follow these instructions: [[TiLDA_MK3/reset|Resetting]]<br />
<br />
If everything else absolutely fails, you can try following these instructions (advanced): [[TiLDA_MK3/Firmware_Update]]<br />
<br />
== Hacking your badge ==<br />
<br />
<br />
'''[[TiLDA_MK3/Introduction_to_badge_hacking|Badge Hacking Workshop Documentation]]'''<br />
<br />
<br />
One of the main goals of TiLDA is to make hacking it as easy as possible. All you need to do so is a computer with USB and your badge.<br />
<br />
* '''[[TiLDA MK3/Get Started|Step-by-step: How to get started]]''' <br />
* '''[[TiLDA MK3/Run Code|3 Ways to run code on your TiLDA]]''' <br />
* [[TiLDA MK3/App Store Submissions|App Store Submissions]]<br />
<br />
The badge itself runs code written in the computer language [https://en.wikipedia.org/wiki/Python_(programming_language) Python] which is run by a bit of software called [https://micropython.org/ Micropython]. <br />
<br />
For more information about the functions available please have a look at the [[#Badge API|Badge API]] section of this page.<br />
<br />
If you're already familiar with all this you can jump right into the topic of Apps. Apps can be shared via the EMF App Library or by copying files of and on via USB. If you want to know more about how this works go to [[TiLDA MK3/apps]]<br />
<br />
In case you're more interested in what makes the hardware tick and your confident with C++ and microprocessors then you can work directly with the micropython code that runs TiLDA: [[TiLDA MK3/build|How to build the firmware from scratch]]<br />
<br />
All code used is hosted on Github. Contributions and PR are very welcome!<br />
* https://github.com/emfcamp/micropython<br />
* https://github.com/emfcamp/Mk3-Firmware<br />
* https://github.com/emfcamp/Mk3-Server<br />
<br />
=== Some ideas ===<br />
<br />
[[TiLDA MK3/Ideas|Please share what you've done (or want to do) with others!]]<br />
<br />
[https://github.com/emfcamp/Mk3-Hardware/blob/master/case-final.dxf Laser cut case files]<br />
<br />
== Badge API ==<br />
<br />
=== Build-in ===<br />
* [http://docs.micropython.org/en/latest/pyboard/ documentation] - General Micropython libarary<br />
* [[TiLDA MK3/ugfx|uGFX]] - The TiLDA LCD colour screen<br />
* [[TiLDA MK3/documentation/cc3100|CC3100]] - The wifi chip<br />
* [[TiLDA MK3/rtc|RTC]] (real time clock)<br />
* [[TiLDA MK3/adc|ADC]] (analogue reading)<br />
* [[TiLDA MK3/timer|Timer]]<br />
* Microcontroller peripherals [https://micropython.org/doc/module/pyb/] (Timers, PWM, serial etc)<br />
<br />
=== TiLDA Libraries ===<br />
On top of the build-in modules above we have also created a bunch of helpful libraries written in python. If you go through the bootstrap process or use the App Library you should always have a full set of those on your badge. If for some reason this isn't the case you can download our repository from https://github.com/emfcamp/Mk3-Firmware and copy the <code>lib</code> folder onto your badge.<br />
<br />
TBD, for now please have a look at the libraries themselves: https://github.com/emfcamp/Mk3-Firmware/tree/master/lib<br />
<br />
* [[TiLDA MK3/lib/buttons|buttons]]<br />
* database<br />
* dialogs<br />
* filesystem<br />
* http_client<br />
* imu<br />
* wifi<br />
* NTP Example: https://gist.github.com/drrk/4a17c4394f93d0f9123560af056f6f30<br />
* On board LED "[[TiLDA MK3/NeoPixel|NeoPixel]]" example: https://github.com/mayhem/tilda-mk3-led-demo<br />
<br />
Full hardware files are on GitHub [https://github.com/emfcamp/Mk3-Hardware]<br />
<br />
(feel free to add additional ideas, and create links new wiki pages to on-going projects, perhaps someone will want to contribute)<br />
<br />
== Badge hardware ==<br />
TiLDA comes with a long list of very useful hardware. Some might be obvious, but some are a bit hidden. <br />
* Colour LCD screen 320x240<br />
* Joystick and A/B/Menu Buttons<br />
* Wifi (cc3100)<br />
* Accelerometer<br />
* Compass<br />
* Buzzer<br />
* Battery<br />
* <s>WS2812B aka "Neo Pixel"</s> on port PB13. [https://badge.emfcamp.org/wiki/TiLDA_MK3/How_to_fix_NeoPixel Sadly defunct]<br />
* MicroSD slot<br />
<br />
Harware files are available on GitHub [https://github.com/emfcamp/Mk3-Hardware].<br />
<br />
NOTE: The WS2812B is actually on pin PB13, not X2 as shown below!<br />
<br />
[[File:pinout-1.png | 500px]] [[File:pinout2-1.png | 500px]]</div>Rajhttps://badge.emfcamp.org/w/index.php?title=TiLDA_MK3/NeoPixel&diff=214TiLDA MK3/NeoPixel2016-08-09T21:56:02Z<p>Raj: </p>
<hr />
<div>One feature of the Mk3 is a single NeoPixel multi-colour LED adjacent to the red power/charge LED.<br />
<br />
==Faulty manufacture==<br />
Unfortunately, during the original manufacture of the badges the NeoPixel was mounted 180 degrees out of orientation. As originally delivered it will not function, being mounted with the triangular notch facing the outer part of the badge and the chip part of the LED (the brown spot under the transparent pastic) facing the charge LED. The correct position is with the triangular notch facing inward and the chip part facing the "D1" label of the silkscreen.<br />
<br />
===Correcting the faulty mount===<br />
The best solution should be to use soldering tweezers take the LED of, clean the pads turn it and put it on but this is a delicate operation that could probably destroy the LED , the trick is to be quick , to use a fairly high temperature (350-370 degreese) and add some new solder to the pads to increase the heat transfer.<br />
<br />
You can possibly use two soldering iron at the same time, one on each side of the LED. <br />
<br />
Avoid hot air at all the cost, the badge is packed and you don't really want to risk to blown the charging LED away or even worst, damage the LCD.<br />
<br />
==Programming the LED==<br />
To follow...</div>Rajhttps://badge.emfcamp.org/w/index.php?title=TiLDA_MK3/How_to_fix_NeoPixel&diff=213TiLDA MK3/How to fix NeoPixel2016-08-09T21:50:30Z<p>Raj: Raj moved page TiLDA MK3/How to fix NeoPixel to TiLDA MK3/NeoPixel</p>
<hr />
<div>#REDIRECT [[TiLDA MK3/NeoPixel]]</div>Rajhttps://badge.emfcamp.org/w/index.php?title=TiLDA_MK3/NeoPixel&diff=212TiLDA MK3/NeoPixel2016-08-09T21:50:30Z<p>Raj: Raj moved page TiLDA MK3/How to fix NeoPixel to TiLDA MK3/NeoPixel</p>
<hr />
<div>===Mounting error===<br />
<br />
As originally delivered, the EMF Camp badge NeoPixel LED does not function. The LED itself is mounted 180 degrees out of correct orientation, with the triangular notch facing the outer part of the badge and the chip part of the LED (the brown spot under the transparent pastic) facing the charge LED.<br />
<br />
The correct position is with the triangular notch facing inward and the chip part facing the "D1" label of the silkscreen.<br />
<br />
===How to fix it===<br />
<br />
The best solution should be to use soldering tweezers take the LED of, clean the pads turn it and put it on but this is a delicate operation that could probably destroy the LED , the trick is to be quick , to use a fairly high temperature (350-370 degreese) and add some new solder to the pads to increase the heat transfer.<br />
<br />
You can possibly use two soldering iron at the same time, one on each side of the LED. <br />
<br />
Avoid hot air at all the cost, the badge is packed and you don't really want to risk to blown the charging LED away or even worst, damage the LCD.</div>Rajhttps://badge.emfcamp.org/w/index.php?title=TiLDA_MK3/NeoPixel&diff=211TiLDA MK3/NeoPixel2016-08-09T21:48:19Z<p>Raj: /* Mounting error */</p>
<hr />
<div>===Mounting error===<br />
<br />
As originally delivered, the EMF Camp badge NeoPixel LED does not function. The LED itself is mounted 180 degrees out of correct orientation, with the triangular notch facing the outer part of the badge and the chip part of the LED (the brown spot under the transparent pastic) facing the charge LED.<br />
<br />
The correct position is with the triangular notch facing inward and the chip part facing the "D1" label of the silkscreen.<br />
<br />
===How to fix it===<br />
<br />
The best solution should be to use soldering tweezers take the LED of, clean the pads turn it and put it on but this is a delicate operation that could probably destroy the LED , the trick is to be quick , to use a fairly high temperature (350-370 degreese) and add some new solder to the pads to increase the heat transfer.<br />
<br />
You can possibly use two soldering iron at the same time, one on each side of the LED. <br />
<br />
Avoid hot air at all the cost, the badge is packed and you don't really want to risk to blown the charging LED away or even worst, damage the LCD.</div>Rajhttps://badge.emfcamp.org/w/index.php?title=TiLDA_MK3/ugfx&diff=188TiLDA MK3/ugfx2016-08-07T13:30:22Z<p>Raj: /* Styles and Fonts */</p>
<hr />
<div>The badge makes use of uGFX for providing drawing functions on the LCD. Most of this functionality is available through the micropython interface, and you may wish to browse the [https://wiki.ugfx.io/index.php/Main_Page uGFX documentation] for more details<br />
<br />
== Basic usage ==<br />
<br />
uGFX is comprised of 'widgets,' such as buttons and labels, and 'containers' which are used to group widgets.<br />
<br />
To create a button on the screen, use <code>ugfx.Button(x,y,width,height,text)</code>, and a button will be drawn on the screen.<br />
<br />
As well as widgets, there are 'primitives' such as drawing circles and lines, which can be drawn anywhere on the screen or in a container.<br />
For example <code>ugfx.circle(50,50,20,ugfx.RED)</code> will draw a circle.<br />
<br />
<br />
<br />
== Detailed documentation ==<br />
<br />
Note. all co-ordinates are from the top left (battery symbol) corner.<br />
<br />
=== Colour format ===<br />
<br />
Internally, ugfx uses 565 format (5 bits for red and blue, 6 for green). Preset colours are available, for example '''ugfx.RED''', '''ugfx.ORANGE''', etc. To convert from 24 bit RGB format, use '''ugfx.html_color(0xRRGGBB)''' to return the 16 bit 565 format.<br />
<br />
=== Styles and Fonts ===<br />
Use <code>ugfx.set_default_font(...)</code> to change the font. The font options are:<br />
* ''ugfx.FONT_SMALL''<br />
* ''ugfx.FONT_MEDIUM''<br />
* ''ugfx.FONT_MEDIUM_BOLD''<br />
* ''ugfx.FONT_TITLE''<br />
* ''ugfx.FONT_NAME''.<br />
Note that widgets use the font which was default when they were created, while the ''container.text()'' primitive uses the font that was default when the container was created<br />
<br />
=== Containers ===<br />
<br />
Containers can be used to group widgets together. They can also perform primitive drawing functions. When drawing widgets or primitives, the coordinates are relative to the top left corner of the container.<br />
<br />
Containers can be shown or hidden, and all the widgets will be redrawn. Containers can also be placed on top of other widgets. When the top container is hidden, the widgets below will be redrawn.<br />
<br />
Upon creation a style can be passed to a container, which will then be used by default by widgets created as part of that container. If no style is specified at creation, the current default style will be used.<br />
<br />
The following example shows how to create a container, add an object and show it.<br />
<pre><br />
c = ugfx.Container(100,100,200,100{,style} # the style is optional<br />
b = ugfx.Button(10, 10, 40, 30, "OK", parent = c}<br />
c.show() # the container will not be shown until this point<br />
</pre><br />
<br />
=== Primitives ===<br />
All primitives can be drawn anywhere on the screen with, for example <code>ugfx.circle(..)</code>, or anywhere within a container, with <code>c=ugfx.Container(30,30,100,100); c.circle(..)</code><br />
<br />
==== Lines ====<br />
<code>.line(<x1>, <y1>, <x2>, <y2>, <colour>)</code><br />
<br />
<code>.thickline(<x1>, <y1>, <x2>, <y2>, <colour>, <width>, <round>)</code><br />
<br />
Draws a line from ''x1,y1'' to ''x2,y2'' using ''colour''. Thickline will draw a line or arbitrary width, with the option of rounded corners<br />
<br />
eg. ''ugfx.thickline(0,0,100,170,ugfx.YELLOW,7,0)''<br />
<br />
==== Circle ====<br />
<code>.circle(x, y, diameter, colour)</code><br />
<br />
<code>.fill_circle(x, y, diameter, colour)</code><br />
<br />
Draws a circle at ''x,y'' of <diameter> using ''colour'', either with a 1 pixel border or filling the area.<br />
<br />
eg. ''ugfx.circle(180,150,40,ugfx.RED)''<br />
<br />
==== Arc ====<br />
<code>.arc(x, y, r, angle1, angle2, colour)</code><br />
<br />
<code>.fill_arc(x, y, r, angle1, angle2, colour)</code><br />
<br />
Similar to the circle functions, however two angle parameters specify between which two angles drawing occurs<br />
<br />
==== Ellipse ====<br />
<code>.ellipse(x, y, a, b, colour)</code><br />
<br />
<code>.fill_ellipse(x, y, a, b, colour)</code><br />
<br />
Draws an ellipse at ''x,y'' of ''a'' width and ''b'' height using ''colour'', either with a 1 pixel border or filling the area.<br />
<br />
==== Squares ====<br />
<code> .box(1, y, a, b, colour) </code><br />
<br />
<code> .area(x, y, a, b, colour)</code><br />
<br />
Draws a rectangle or filled rectangle at ''x,y'' of ''a'' width and ''b'' height using ''colour''.<br />
<br />
==== Polygon ====<br />
<code> .polygon(x, y, array, colour) </code><br />
<br />
<code> .fill_polygon(x, y, array, colour) </code><br />
<br />
Draws or fills a polygon starting at ''x,y'' using ''colour''. ''Array'' is an array of coordinates that specifies the corners.<br />
<br />
eg. ''ugfx.circle(0,0, [ [0,20],[20,20],[20,0]], ugfx.RED)''<br />
<br />
==== Text ====<br />
<code>.text(x, y, text, colour) </code><br />
<br />
Draws a text string ''text'' at ''x,y'' in ''colour''.<br />
Note that a ugfx.text(..) call will take the default font, while container.text(..) will take the containers font.<br />
<br />
eg. ''ugfx.text(40,40,"My name is...",ugfx.BLUE)''<br />
<br />
==== Other ====<br />
<code>.width()</code><br />
<br />
<code>.height()</code><br />
<br />
Gets the height or width of the screen or container<br />
<br />
=== Widgets ===<br />
<br />
Widgets can be drawn anywhere on the screen, or within a container. The widgets take the optional parameter ''parent='' to set the parent container. Widgets can have their style set on creation, otherwise will inherit <br />
<br />
Widgets also accept input from the buttons. For example, the 'A' button can be 'attached' to an on-screen button, such that pressing the button on the badge causes the on-screen button to be redrawn in a depressed state. <br />
<br />
==== Common ====<br />
<br />
<code>.text([text])</code><br />
<br />
Gets or sets the text displayed by the widget.<br />
<br />
<code>.visible([show])</code><br />
<br />
Gets or sets the visibility of the badge. ''b.visible(0)'' will hide, and ''b.visible(1)'' will show.<br />
<br />
<code>.attach_input(button, function)</code><br />
<br />
Attaches a physical button to a widget, so that the user can cause the widget to redraw, for example to scroll or become depressed.<br />
<br />
The input ''button'' specifies which button, with the options ugfx.BTN_A, ugfx.BTN_B, ugfx.BTN_MENU, ugfx.JOY_UP, ugfx.JOY_DOWN, ugfx.JOY_LEFT, ugfx.JOY_RIGHT.<br />
<br />
The input ''function'' specifies what the button actually does. For example, the list has three different functions: scroll up, scroll down, and select. Note that some widgets by default attach the joystick to the relevant functions. <br />
<br />
<code>.detach_input(function)</code><br />
<br />
Detaches an input. See above for more details.<br />
<br />
<code>.destroy()</code><br />
<br />
Frees up all the resources assoicated with the object. While the micropython garbage collector will clear any old objects, the graphics library also has its own memory area, which can become full if objects are not destroyed after they are needed.<br />
<br />
<code>.set_focus()</code><br />
<br />
Gives focus to the widget instance. Normally this will draw a box around the widget, the colour is specified by the style.<br />
<br />
==== Button ==== <br />
<br />
<code> b=ugfx.Button(x, y, a, b, text, *, parent=None, trigger=None, shape=ugfx.Button.RECT, style=None) </code> (note: parameters after '*' are optional)<br />
<br />
Draws a button at ''x,y'' having width ''a'' and height ''b''. The option 'trigger' specifics which physical switch (if any) causes the display to be redrawn. The shape options are ''ugfx.Button.RECT'', ''ugfx.Button.ROUNDED'', ''ugfx.Button.ELLIPSE'', ''ugfx.Button.ARROW_UP'', ''ugfx.Button.ARROW_DOWN'', ''ugfx.Button.ARROW_LEFT', ''ugfx.Button.ARROW_RIGHT''.<br />
<br />
==== Textbox ====<br />
<code> ugfx.Textbox(x, y, a, b, *, text=None, parent=None, maxlen=255})</code><br />
<br />
Draws a text edit-box which can take input from the on-screen keyboard. Will automatically accept key-presses from the keyboard, which will edit the text. The textbox needs to have focus using .set_focus() for it to receive the key-presses.<br />
<br />
==== Label ====<br />
<br />
<code> ugfx.Label(x, y, a, b, text, *, parent=None, style=None, justification=None)</code><br />
<br />
A label displays text. Unlike the primitive text, this Label supports different justifications, wordwrap and changing text. The different justification options are ''ugfx.Label.LEFT'', ''ugfx.Label.RIGHT'', ''ugfx.Label.CENTER'', ''ugfx.Label.LEFTTOP'', ''ugfx.Label.RIGHTTOP'' and ''ugfx.Label.CENTERTOP''.<br />
<br />
==== List ====<br />
<br />
<code>.List(x, y, a, b, *, parent=None, up=ugfx.JOY_UP, down=ugfx.JOY_DOWN, style=None)</code><br />
<br />
<code>.enable_draw()</code><br />
<br />
<code>.disable_draw()</code><br />
<br />
<code>.add_item(text)</code><br />
<br />
<code>.assign_image(index, image)</code><br />
<br />
<code>.remove_item(index)</code><br />
<br />
<code>.selected_text()</code><br />
<br />
<code>.selected_index()</code><br />
<br />
<code>.count()</code><br />
<br />
==== Keyboard ====<br />
<br />
=== Styles ===<br />
<br />
== Tips and tricks ==<br />
<br />
=== Tearing ===<br />
<br />
When writing large areas of the screen, a 'tearing' [https://en.wikipedia.org/wiki/Screen_tearing] effect may be observed.<br />
<br />
The screen module is comprised of a large memory, with one memory location to store the RGB data for each pixel. The LCD driver continuously updates the LCD pixels, by reading the memory in a sequential, line-by-line manner, and updating the LCD with the data from the memory. This 'read line-pointer' moves from the top to the bottom of the screen (when viewed in portrait), at about 70Hz (the refresh rate of the screen)<br />
<br />
This large memory as part of the screen means it can be driven by a microcontroller which may have a considerably smaller memory. The microcontroller therefore only needs to update the memory when it whats the content to change. <br />
<br />
Consider the scenario where the microcontroller wants to set the screen from one colour to another. The microcontroller needs to update the entire memory (320x240x2 = 153kB) with the new colour. At the same time the 'read line-pointer' is reading the same memory to update the LCD. In this case, tearing occurs if the 'read line-pointer' reads the top half of the memory containing the new colour, but then catches up with microcontroller writing to the memory, then the 'read line-pointer' starts reading the old colour in the bottom half of the memory.<br />
<br />
To avoid tearing the 'read line-pointer' should not cross the region the microcontroller is updating. Since the microcontroller writes to the screen slightly slower than the LCD reads it, providing the microntroller starts writes to the top of the memory just after the LCD starts reading from the top, the read and write pointers will not overlap, and tearing will not occur. To sync the microcontroller with the LCD 'read line-pointer,' there is a vsync/tear output (connected to pin named 'TEAR') which is pulled high when the 'read line-pointer' reaches a given line (default is line 0). This can be turned on and off with '''ugfx.enable_tear()''' and '''ugfx.disable_tear()'''. To change the line at which the tear output is generated, use '''ugfx.set_tear_line(0..319)'''.<br />
<br />
<br />
<br />
=== Reducing power consumption ===<br />
Use the following to dim the backlight, which uses about 80mA at full brightness<br />
<pre><br />
ugfx.backlight(b) # sets the backlight. Range is 0-100<br />
b = ugfx.backlight() # reads the current backlight<br />
</pre></div>Rajhttps://badge.emfcamp.org/w/index.php?title=User:Raj&diff=187User:Raj2016-08-07T13:28:21Z<p>Raj: Created page with "New user as of EMF:2016. Poking around to understand the badge, and maybe contribute if there are gaps in the documentation. Wiki-savvy. (Several hundred man-hours contribu..."</p>
<hr />
<div>New user as of EMF:2016.<br />
<br />
Poking around to understand the badge, and maybe contribute if there are gaps in the documentation.<br />
<br />
Wiki-savvy. (Several hundred man-hours contributed to Wikipedia late last decade.)</div>Raj