PetRockBlock https://blog.petrockblock.com Fun Stuff for Technics Enthusiasts Tue, 04 Jul 2017 10:25:47 +0000 en-US hourly 1 https://wordpress.org/?v=4.8 Tutorial: PowerBlock with Raspbian https://blog.petrockblock.com/2017/06/30/tutorial-powerblock-raspbian/ https://blog.petrockblock.com/2017/06/30/tutorial-powerblock-raspbian/#respond Fri, 30 Jun 2017 07:48:40 +0000 https://blog.petrockblock.com/?p=123304 This is a post as part of a tutorial series about getting to start with the PowerBlock with various images for the Raspberry Pi. In this tutorial we will learn how to use the PowerBlock with Raspbian, the most common operating system for the Raspberry. Preparation If you have not already done it, we need …

The post Tutorial: PowerBlock with Raspbian appeared first on PetRockBlock.

]]>
This is a post as part of a tutorial series about getting to start with the PowerBlock with various images for the Raspberry Pi. In this tutorial we will learn how to use the PowerBlock with Raspbian, the most common operating system for the Raspberry.

Preparation

If you have not already done it, we need to download the Raspbian image first. You get the image on the official Raspberry Pi downloads site. When you have downloaded the image you need to load it on your SD card. You can follow the Raspberry Pi Software guide for that, if you are unsure how to do that.

Installing the PowerBlock Hardware

Make sure that the Raspberry Pi is switched off before you do any hardware work on it. Attach the PowerBlock with its 2×6 female header to the GPIO pins of the Raspberry Pi as shown on the following image:

PowerBlock with Attached Power Switch
PowerBlock with Attached Power Switch

Attach your power switch to the two pins that are marked with “Switch”. Again, the above image shows that exemplarily.

Attach the micro USB connector of your power supply to the micro USB connector of the PowerBlock:

PowerBlock with attached micro USB cable
PowerBlock with attached micro USB cable
It is important that you connect your switch to the PowerBlock before you connect the micro USB cable of your power supply. Otherwise the Raspberry Pi will start with an endless loop of booting and shutting down.

Installing the PowerBlock Service

In order to install the PowerBlock driver and service we can follow the quick installation instructions as given on the driver Github site. To install the driver and the service you just need to call this one command:

wget -O - https://raw.githubusercontent.com/petrockblog/PowerBlock/master/install.sh | sudo bash

That command will download the installation script of the PowerBlock service and start the script. It will compile and install the driver as well as install and start the service.

When the script is finished, you get a success or failure message in the console. In case of a success, you can also see that the optional status LED stopped to flash and, instead, is permanently switched on.

Conclusion

As you can see, getting started with the PowerBlock involves very few steps. We hope you enjoy your PowerBlock and wish you good luck with your project!

The post Tutorial: PowerBlock with Raspbian appeared first on PetRockBlock.

]]>
https://blog.petrockblock.com/2017/06/30/tutorial-powerblock-raspbian/feed/ 0
Quick Installation Script for the PowerBlock https://blog.petrockblock.com/2017/06/29/quick-install-script-powerblock/ https://blog.petrockblock.com/2017/06/29/quick-install-script-powerblock/#respond Thu, 29 Jun 2017 12:25:58 +0000 https://blog.petrockblock.com/?p=123345 Making the PowerBlock ready to go becomes even easier! The installation of the PowerBlock driver is now a one-liner. We summarised the installation steps that are needed for installing the PowerBlock driver and the service and put all that as an installation script into the driver repository. That means, to install the driver and service …

The post Quick Installation Script for the PowerBlock appeared first on PetRockBlock.

]]>
Making the PowerBlock ready to go becomes even easier!

The installation of the PowerBlock driver is now a one-liner. We summarised the installation steps that are needed for installing the PowerBlock driver and the service and put all that as an installation script into the driver repository.

That means, to install the driver and service for the PowerBlock you need to call this line on the console:

wget -O - https://raw.githubusercontent.com/petrockblog/PowerBlock/master install.sh | sudo bash

And that’s it! To uninstall the PowerBlock service you just need to call

sudo ./uninstall.sh

You can also find all these information in the README within the PowerBlock repository

We hope you find that helpful and wish you good luck with your project!

The post Quick Installation Script for the PowerBlock appeared first on PetRockBlock.

]]>
https://blog.petrockblock.com/2017/06/29/quick-install-script-powerblock/feed/ 0
Quick Installation Script for the ControlBlock https://blog.petrockblock.com/2017/05/21/quick-installation-script-for-the-controlblock/ https://blog.petrockblock.com/2017/05/21/quick-installation-script-for-the-controlblock/#respond Sun, 21 May 2017 20:12:06 +0000 http://blog.petrockblock.com/?p=123041 We realized that the installation of the ControlBlock driver could be simplified. Therefore, we created an installation script that does all the needed steps for compiling, installing the binary, and configuring the ControlBlock service for you! To install the driver and service for the ControlBlock, this is now all that ou have to do: Also, …

The post Quick Installation Script for the ControlBlock appeared first on PetRockBlock.

]]>
We realized that the installation of the ControlBlock driver could be simplified. Therefore, we created an installation script that does all the needed steps for compiling, installing the binary, and configuring the ControlBlock service for you!

To install the driver and service for the ControlBlock, this is now all that ou have to do:

git clone git://github.com/petrockblog/ControlBlockService2
cd ControlBlockService2
sudo ./install.sh

Also, there is a Youtube video that shows you a typical run of that quick installation script:

You can also find all these information in the README within the ControlBlock repository.

We hope you find that helpful and wish you good luck with your project!

The post Quick Installation Script for the ControlBlock appeared first on PetRockBlock.

]]>
https://blog.petrockblock.com/2017/05/21/quick-installation-script-for-the-controlblock/feed/ 0
Update for the ControlBlock Driver with Many New Features https://blog.petrockblock.com/2017/02/19/update-controlblock-driver/ https://blog.petrockblock.com/2017/02/19/update-controlblock-driver/#comments Sun, 19 Feb 2017 15:02:19 +0000 http://blog.petrockblock.com/?p=123028 We just released an update for the driver of the ControlBlock! What does this mean for you? More functionalities! More specifically, the updates contain: 4-player support Multiple ControlBlocks can be stacked on top of each other. With this functionality you can now create your 4-player arcade machine with two ControlBlocks. Each ControlBlock can be configured …

The post Update for the ControlBlock Driver with Many New Features appeared first on PetRockBlock.

]]>
We just released an update for the driver of the ControlBlock! What does this mean for you? More functionalities!

More specifically, the updates contain:

  1. 4-player support
    Multiple ControlBlocks can be stacked on top of each other. With this functionality you can now create your 4-player arcade machine with two ControlBlocks. Each ControlBlock can be configured with its own controller type. That means for example that you could provide two full sets of arcade controllers and two, say, SNES controllers – you can choose!

  2. Genesis/Megadrive, Atari controller support
    The driver now support Genesis / Megadrive and Atari controllers. Both types, the three as well as the six button Genesis controllers, are supported. To use Genesis controllers with the ControlBlock simply set “genesis” as gamepad type in the driver config file.
    Sega Genesis / Megadrive (TM) Controllers are now supported by the ControlBlock

  3. Custom shutdown script
    We got several requests from users who want to execute their own scripts when the power switch is switched to “off”. The whole shutdown actions are now defined in the file /etc/controlblockswitchoff.sh You can add anything you want to be executed on switch off to that script now.

  4. Reset button for SNES gamepad mode
    SNES mode now also provides a reset button functionality. If you want to build your personal retro-gaming machine within a SNES or NES case you can now also connect the reset button to the ControlBlock. The reset button is mapped to the ESC key, which in turn exits for example a running emulator.

ControlBlock with attached SNES Reset Button ControlBlock attached to original SNES Hardware

The reset button must be connected to GND and Player 1, Input B. All configuration settings and detailed information about the other functions are described at the Github site of the driver.

Besides updates of the ControlBlock driver there are now driver modules for the ControlBlock (and the PowerBlock as well) in RetroPie. That makes it even easier for you to install the PowerBlock or ControlBlock driver for your RetroPie project. You find the drivers in the RetroPie-Setup menu at “Manage packages” → “Manage driver packages” → “controlblock”. From there, you can easily install or remove the driver from within the RetroPie Setup.

We hope you enjoy these new features!

If you are missing any functionality or support for different controllers feel free to comment below.

The post Update for the ControlBlock Driver with Many New Features appeared first on PetRockBlock.

]]>
https://blog.petrockblock.com/2017/02/19/update-controlblock-driver/feed/ 12
New Revision of the PowerBlock: Increased Flexibility https://blog.petrockblock.com/2016/05/20/new-revision-of-the-powerblock-increased-flexibility/ https://blog.petrockblock.com/2016/05/20/new-revision-of-the-powerblock-increased-flexibility/#comments Fri, 20 May 2016 20:15:15 +0000 http://blog.petrockblock.com/?p=122629 The PowerBlock is a small support shield for the Raspberry Pi that provides a power switch functionality. Recently, we have updated the design of the PowerBlock such that it now offers an even greater flexibility regarding the connections with the Raspberry Pi. Here is an image of the new PowerBlock Revision 1.1: Besides some fine …

The post New Revision of the PowerBlock: Increased Flexibility appeared first on PetRockBlock.

]]>
The PowerBlock is a small support shield for the Raspberry Pi that provides a power switch functionality. Recently, we have updated the design of the PowerBlock such that it now offers an even greater flexibility regarding the connections with the Raspberry Pi.

Here is an image of the new PowerBlock Revision 1.1:

IMG_2907

Besides some fine tunings in the board layout, these are the major differences to the previous revision of the PowerBlock:

Additional signal breakouts so that input voltage, output voltage, and control signals
All the signal above can now be attached to the Raspberry Pi without using the 2×6 pin connector. As you can see on the image below, there are individual pin outs for the 5V input voltage, the 5V output voltage, as well as for the control signals S1, and S2.

IMG_2907_zoom

The pin out is as following:

5V IN, +,-: supply voltage
S1: pin 12
S2: pin 11
5V OUT +: pin 2 or pin 4
5V OUT -: pin 6 or pin 9

Additional mounting hole for attaching a Raspberry Pi Zero
This addition makes it possible to not only mount the PowerBlock to the Raspberry Pi model A and B, but also to the Raspberry Pi Zero. Here are some exemplary images for the various models:

RPi Model A RPi Model B RPi Zero
IMG_2912  IMG_2911  IMG_2909 

Together with a toggle switch the PowerBlock provides a reliable and safe power switch functionality for the Raspberry Pi. An optional LED can also be attached to the PowerBlock that serves as a power status indicator.

IMG_2913

You can find more details and a comprehensive installation and configuration description on the description site of the PowerBlock.

The post New Revision of the PowerBlock: Increased Flexibility appeared first on PetRockBlock.

]]>
https://blog.petrockblock.com/2016/05/20/new-revision-of-the-powerblock-increased-flexibility/feed/ 46
Python module for MCP23S17 for use with the Raspberry Pi https://blog.petrockblock.com/2016/05/15/python-module-for-mcp23s17-for-use-with-the-raspberry-pi/ https://blog.petrockblock.com/2016/05/15/python-module-for-mcp23s17-for-use-with-the-raspberry-pi/#comments Sun, 15 May 2016 13:50:14 +0000 http://blog.petrockblock.com/?p=112746 Some time ago I revised the hardware design of the ControlBlock and added test points for all major signals. The overall aim was to build a device for doing final system tests that are done before any single ControlBlock leaves for shipping. These system tests are written in Python. This post is about a Python …

The post Python module for MCP23S17 for use with the Raspberry Pi appeared first on PetRockBlock.

]]>
IMG_2906_FotorSome time ago I revised the hardware design of the ControlBlock and added test points for all major signals. The overall aim was to build a device for doing final system tests that are done before any single ControlBlock leaves for shipping. These system tests are written in Python. This post is about a Python module for the MCP23S17 to be used on a Raspbbery Pi.

Basically, the tests set various input signal lines to logical high and low values in a specific order and test if certain output signals have the correct level. To do this, another manually tested ControlBlock is used. Since revision 2.X the ControlBlock uses MCP23S17 GPIO expanders to provide 32 input/output lines for arbitrary usage. I did not find any Python abstraction that would allow me to easily access the MCP23S17 from a Raspberry Pi, so I decided to write a Python module myself.

The result is a publicly available Python module, available via PyPI, that you can install with pip.

Installing the Module

If not already done, you need to install PIP via::

sudo apt-get install python-dev python-pip

Then you can install the module from PyPI via

pip install RPiMCP23S17

That’s it!

Interface of the Module

So, how do you use the module. How does its interface look like? Here is a list of the public methods of the module together with brief descriptions:

  • Constructor – Initializes an instance given the SPI bus number, the chip-enable (CE) number, and the device ID of the MCP23S17 component.
  • open – Opens the configured SPI-bus with hardware-address access and sequential operations mode.
  • close – Closes the SPI connection that the MCP23S17 component is using.
  • setPullupMode – Enables or disables the pull-up mode for a given input pin.
  • setDirection – Sets the direction for a given pin.
  • digitalRead – Reads the level of a given pin.
  • digitalWrite – Sets the level of a given pin.
  • writeGPIO – Sets the 16-bit data port value for all pins.
  • readGPIO – Reads the 16-bit data port value of all pins.

You can find a detailed documentation in the Python docstrings of the module.

Exemplary Usage

Here is some demo code that also comes with the module sources. The demo periodically toggles all pins of two MCP23S17 expanders:

mcp1 = MCP23S17(deviceID=0x00)
mcp2 = MCP23S17(deviceID=0x01)
mcp1.open()
mcp2.open()

for x in range(0, 16):
mcp1.setDirection(x, mcp1.DIR_OUTPUT)
mcp2.setDirection(x, mcp1.DIR_OUTPUT)

while (True):
for x in range(0, 16):
mcp1.digitalWrite(x, MCP23S17.LEVEL_HIGH)
mcp2.digitalWrite(x, MCP23S17.LEVEL_HIGH)
time.sleep(1)

for x in range(0, 16):
mcp1.digitalWrite(x, MCP23S17.LEVEL_LOW)
mcp2.digitalWrite(x, MCP23S17.LEVEL_LOW)
time.sleep(1)

So, if you are tinkering with MCP23S17 components and Python on a Raspberry Pi, you might find this module to be helpful for you.

You can find the module on PyPi here.

By the way, here is an image of the testing station for the ControlBlocks, which we are using to do the final system tests before shipping:

IMG_2905
System Test Station for the ControlBlock using the MCP23S17 and test scripts written in Python

The post Python module for MCP23S17 for use with the Raspberry Pi appeared first on PetRockBlock.

]]>
https://blog.petrockblock.com/2016/05/15/python-module-for-mcp23s17-for-use-with-the-raspberry-pi/feed/ 2
RetroPie 3.6 is Released https://blog.petrockblock.com/2016/03/02/retropie-3-6-is-released/ https://blog.petrockblock.com/2016/03/02/retropie-3-6-is-released/#comments Wed, 02 Mar 2016 06:29:40 +0000 http://blog.petrockblock.com/?p=118794 RetroPie on Raspberry Pi 3? Get RetroPie 3.6! This version is released a little earlier than originally planned, due to the release of the fantastic Raspberry Pi 3 – which our previous 3.5 will not boot on due to having out of date firmware. Along with Raspberry Pi 3 compatibility this release brings a bunch …

The post RetroPie 3.6 is Released appeared first on PetRockBlock.

]]>
Pixel-ArtRetroPie on Raspberry Pi 3? Get RetroPie 3.6!

This version is released a little earlier than originally planned, due to the release of the fantastic Raspberry Pi 3 – which our previous 3.5 will not boot on due to having out of date firmware. Along with Raspberry Pi 3 compatibility this release brings a bunch of interesting experimental emulators such as Daphne for emulation of classic LaserDisc arcade games, a myriad of libretro cores, and a few game engines. We’ve also worked around the pesky insert coin bug that has plagued the arcade emulators.

You can find the links for the SD-card images as usual in the Downloads Sections.
Installation Instructions can be found at Github: https://github.com/RetroPie/RetroPie-Setup/wiki/First-Installation

Changes since 3.5:

Added Support for the Raspberry Pi 3

  • Added new experimental modules:
    • Daphne (Laserdisc Emulator)
    • Libretro-QuickNES
    • Libretro-Beetle PSX (x86 only)
    • Libretro-Beetle Lynx
    • GemRB engine (Baldur’s Gate, Icewind Dale, Planescape)
    • ResidualVM (Engine for Grim Fandango and Escape from Monkey Island)
    • Libretro-MESS (based on the most recent version of MAME)
    • Libretro-MAME (based on the most recent version of MAME)
  • Added EmulationStation theme Simpler Turtle Pi to the theme installer from Omnija.
  • Added version details and uninstall option to the RetroPie Setup Script.
  • Fixed insert coin not working on arcade based emulators.
  • Various other bugfixes and improvements.

The post RetroPie 3.6 is Released appeared first on PetRockBlock.

]]>
https://blog.petrockblock.com/2016/03/02/retropie-3-6-is-released/feed/ 47
RetroPie 3.5 is Released https://blog.petrockblock.com/2016/02/06/retropie-3-5-is-released/ https://blog.petrockblock.com/2016/02/06/retropie-3-5-is-released/#comments Sat, 06 Feb 2016 16:00:30 +0000 http://blog.petrockblock.com/?p=116351 We are pleased to announce the release of RetroPie 3.5. After taking into consideration the feedback from the vibrant RetroPie community, we have provided a few more functions to simplify the user experience such as automatic expansion of the filesystem on boot, less terminal text, and more configuration options for the runcommand launch menu. We …

The post RetroPie 3.5 is Released appeared first on PetRockBlock.

]]>
Pixel-ArtWe are pleased to announce the release of RetroPie 3.5.

After taking into consideration the feedback from the vibrant RetroPie community, we have provided a few more functions to simplify the user experience such as automatic expansion of the filesystem on boot, less terminal text, and more configuration options for the runcommand launch menu. We have also fixed up some bugs with Raspbian Jessie such as the USB ROM service and have added two new experimental modules – the Löve game engine and a ColecoVision emulator (CoolCV).

You can find the links for the SD-card images as usual in the Downloads Sections.
Installation Instructions can be found at Github: https://github.com/RetroPie/RetroPie-Setup/wiki/First-Installation

Changes since 3.4:

  • Added new experimental modules, Lӧve 2D Game Engine, Colecovision (CoolCV).
  • Debian usbmount package fixed up for systemd udev compatibility, making the USB ROM service work properly again without being killed after 30 seconds. Also added ntfs support by default.
  • Added an arcade rom folder option where all arcade games can be placed.
  • Improvements to EmulationStation (Fix crash on rom delete, direct launch, symlink support, and other bug fixes).
  • Improvements to the Runcommand Launch Menu: Cleaner dialog on launch, ability to show game artwork on launch, ability to disable joystick support as well as the ability to disable the entire runcommand launch menu.
  • PS3 Controller improvements – Add multiple gasia and shanwan controller support.
  • Updated lr-mgba emulator binaries (new upstream release of mgba 0.4.0)
  • Improvements on pre-built image – disabled screen blanking, quieter boot, and filesystem automatically expanded on first boot.
  • Various other bug fixes.

The post RetroPie 3.5 is Released appeared first on PetRockBlock.

]]>
https://blog.petrockblock.com/2016/02/06/retropie-3-5-is-released/feed/ 25
RetroPie 3.4 is Released https://blog.petrockblock.com/2016/01/21/retropie-3-4-is-released/ https://blog.petrockblock.com/2016/01/21/retropie-3-4-is-released/#comments Thu, 21 Jan 2016 20:36:25 +0000 http://blog.petrockblock.com/?p=114675 Mostly fixes and improvements rather than new stuff this time folks. There were some problems with our RetroArch configuration defaults in RetroPie 3.3 which should be sorted now, and we have fixed up a few things that didn’t work correctly with Raspbian Jessie. We also have added early support for using the RetroPie-Setup script on …

The post RetroPie 3.4 is Released appeared first on PetRockBlock.

]]>
Mostly fixes and improvements rather than new stuff this time folks.

There were some problems with our RetroArch configuration defaults in RetroPie 3.3 which should be sorted now, and we have fixed up a few things that didn’t work correctly with Raspbian Jessie. We also have added early support for using the RetroPie-Setup script on a X86/X11 desktop setup, as well as some basic support for building EmulationStation & RetroArch + cores on the ODroid-C1. For more information regarding installation on x86 see https://github.com/RetroPie/RetroPie-Setup/wiki/RetroPie-Ubuntu-15.10-x86-Flavor.

We are now using Raspbian Jessie as the base for the RetroPie image. Those using Wheezy can update RetroPie-Setup and emulators by following the instructions at https://github.com/RetroPie/RetroPie-setup/wiki/Updating-RetroPie – however moving to Jessie is recommended. As it takes time to pre-build binaries, in the future we will only be providing pre-built binaries for Raspbian Jessie.

You can find the links for the SD-card images as usual in the Downloads Sections.
Installation Instructions can be found at Github: https://github.com/RetroPie/RetroPie-Setup/wiki/First-Installation

Changes since 3.3

  • Now using Raspbian Jessie for the RetroPie image.
  • Fixes for controller input issues with RetroArch including improved config generation to work around problems with 8bitdo controllers.
  • Fixed up Bluetooth pairing module on Jessie.
  • Improvements to the Xbox userspace driver (xboxdrv) including partial support of Xbox One controller.
  • Can now choose to exit or restart Emulation Station. Metadata will no longer be lost if choosing to shutdown or reboot.
  • Preliminary support for using the RetroPie-Setup script on x86 + X11 on Debian/Ubuntu and Ubuntu on the Odroid-C1 (building from source only).
  • $HOME/.emulationstation has relocated to /opt/retropie/configs/all/emulationstation – but is symlinked from the original location. The USB Rom Service script will backup all of /opt/retropie/configs to USB. Previously it only backed up /$HOME/.emulationstation.
  • Support for choosing RetroArch shaders and overlays from the RetroPie-Setup configuration editor.
  • Added pixel theme from Rookervik to theme installer.
  • Wonderswan and NeoGeo Pocket separated into Wonderswan/Wonderswan Colour, NeoGeo Pocket/NeoGeo Pocket Colour.
  • Various other bugfixes and improvements.

The post RetroPie 3.4 is Released appeared first on PetRockBlock.

]]>
https://blog.petrockblock.com/2016/01/21/retropie-3-4-is-released/feed/ 3
MEAN adventures continued: An UML Online Editor for PlantUML https://blog.petrockblock.com/2015/12/23/mean-adventures-continued/ https://blog.petrockblock.com/2015/12/23/mean-adventures-continued/#respond Wed, 23 Dec 2015 09:56:06 +0000 http://blog.petrockblock.com/?p=112297 Some weeks ago I wrote about my recent journeys into the world of web application development and the MEAN stack. While writing that blog post I realized that I would like to insert a certain UML diagram. So I first started to draw an UML diagram for a better explanation of the use cases that …

The post MEAN adventures continued: An UML Online Editor for PlantUML appeared first on PetRockBlock.

]]>
Some weeks ago I wrote about my recent journeys into the world of web application development and the MEAN stack. While writing that blog post I realized that I would like to insert a certain UML diagram. So I first started to draw an UML diagram for a better explanation of the use cases that my learning project should implement. I did that with a tool that was locally installed on my machine and things did not work out as fast as I expected. I started to think about an alternative … the resulting UML editor and sharing platform can be found at texwriting.com.

Motivation

I realized that I did not really want to install a specific UML editor on my machine or spend too much time to look for another UML service. Instead, I would like to use an online UML editor that would let me edit, manage, and share the UML diagrams for my articles. Of course, there already exist other online UML editors, but I did not exactly find what I was looking for and I also liked the idea to implement something like that myself — what a great opportunity to continue my experiments with the MEAN stack and, specifically, getting to know user management concepts with Angular.js and Node.js! So, I decided to create the UML editor as an addition to the tool site texwriting.com that I wrote about some weeks ago.

So, here it is: An online UML editor based on PlantUML. What is PlantUML? PlantUML is an application-specific language for describing UML diagrams. It allows you to create UML diagrams just by describing it in text form. It is well-formed and human-readable. I like the idea of a textual UML diagram representation, because it the user to describe exactly those elements and only those elements that are important and the user does not have to care for the layout or arrangement of the elements in the first place.

Functionalities

So, what does the UML editor do? The following figure gives an overview about the use cases of the editor. It is actually a use-case diagram that was created and is hosted with the presented UML editor:

The platform offers the functionalities

  • (of course) to edit UML diagrams with the help of PlantUML syntax,
  • to generate the diagram images in various file formats,
  • to embed and share diagrams with other users or websites,
  • to load PlantUML templates for different types of UML diagrams.

Further more, I have added functionalities for managing user accounts and documents that can be associated to individual users.

A more detailed (and slightly overloaded) version of the overview about the use-cases is given in the following diagram. That diagram was the used for guiding the work on this editor:

Use cases, more detailed

The editing view is split into two parts: The left side contains the editor, and diagram configurations. The right part shows the actual diagram:

Editing view

One feature that turned out to be very helpful is an auto-update function: If the textual diagram description has changed the diagram preview is updated automatically. This allows for a seamless work flow when editing a diagram.

In order to use the document management functions, you need to sign up a free user account,

User profile view

The document management functions are located within a sidebar,

UML document management in the sidebar

Also, the platform at is intended to be used for hosting the diagram image files. This makes sharing and embedding the diagrams into other websites easy. The diagrams that are shown in this article are already created and hosted with texwriting.com. In order to embed a diagram you simply copy the link of the image format of your choice,

The sharing view

and insert the URL into your website, for example, via an image HTML tag

<img src="https://www.texwriting.com/api/v1/uml/get/svg/4b54492ca2b328ae739a58235712955c" alt="An exemplary diagram" />;

or via Markdown as

![An exemplary diagram](https://www.texwriting.com/api/v1/uml/get/svg/4b54492ca2b328ae739a58235712955c)

Behind the Curtains: Some of the used Javascript Libraries

For those of you that are interested in some technical details, here are some Javascript libraries that I used for the implementation of the functionalities:

angular-toastr

An Angular.js library for non-blocking visual notifications or toasts. It has a simple API, for example:

app.controller('foo', function($scope, toastr) {
    toastr.success('Hello world!', 'Toastr fun!');
});

yields this notification toast:

jwt-simple

This library provides functions for handling JSON web tokes. A well-written tutorial about it can be found here. JWTs are used for user authentication on the server-side of texwriting.com. Some exemplary code for generating a JSON Web Token might look like this:

function createJWT(user) {
    var payload = {
        sub: user._id,
        iat: moment().unix(),
        exp: moment().add(14, 'days').unix()
    };
    return jwt.encode(payload, config.TOKEN_SECRET);
}

moment

The library moment.js provides functions for parsing, validating, manipulating, and displaying dates in Javascript. An exemplary date manipulation looks like this:

var today = moment().startOf('day')
var aMonthAgo = moment(today).subtract(30, 'days')

winston

The Winston library is designed to be a simple and universal logging library for Node.js. IT allows the configuration of multiple storage devices for the logs, for example, the console, files, or a database.

Gulp

Gulp is not a Node.js library for direct inclusion into your application, but a task automation framework. I use it for linting the Javascript files, as well as for minifying the Javascript and HTML files.

Summary and Conclusions

In this project I implemented an online UML editor platform that allows to edit, collaborate and share UML diagrams. The platform makes use of PlantUML. This small project taught me how to do user management with Angular.js and Node.js. The UML service is available at texwriting.com. Looking back, I realize how easy it was to add the PlantUML compiler to the Node.js server. Having implemented all the mentioned functionalities I can say that I enjoy creating and embedding diagrams with that platform now. I have ideas for optimization here and there, but the site is already working quite well.

The post MEAN adventures continued: An UML Online Editor for PlantUML appeared first on PetRockBlock.

]]>
https://blog.petrockblock.com/2015/12/23/mean-adventures-continued/feed/ 0