chebe: (Spools of thread)
My first project from Gertie Sews Vintage Casual is the Easy Knit Pencil Skirt. The name says it all really. I made mine in a nice dotted Ponte de Roma knit. Sew it up, wear. The length hits about mid/upper shin/calf, and it is so comfortable to wear, but looks so smart. Will have to make more.

Notes;
The book says to use 30mm elastic, but I couldn't find any anywhere. It's either 25mm or 38mm. I used 25mm, it doesn't seem to affect the outcome.

It also says to use a twin needle to hem. Which seems straight forward, but whether it was the fabric or the machine, this just refused to work for me. Used a stretch/lightning stitch instead.



Finished Easy Knit Pencil Skirt
Photo by chebegeek

LED'd plush Cthulhu

2017-Oct-19, Thursday 12:56 pm
chebe: (Teddy)
Choly Knight has a free plush Cthulhu pattern on their website that is totally adorable. (Actually, many cute plushies!) But, maybe, could be a little more terrifying? LEDs, yes, LEDs for eyes!

Also, I want to play with the Gemma M0, which is much like the previous Gemma, but it comes set up with CircuitPython, a derivative of MicroPython. So instead of installing the Arduino IDE and installing all the boards and libraries, it mounts as a USB flash drive, and you just write your python script in any text editor. Save it, unplug, and it will start running it. (Caveat; space is limited so not all libraries are on the Gemma M0. You'll have to copy over a library if it isn't there. Luckily there's lots of documentation. (And the NeoPixel library is already there.))


Labour for the Great Old Ones! )



All hail
Photo by chebegeek

Sailfish X, part 4

2017-Oct-11, Wednesday 05:13 pm
chebe: (Default)
Once you got the Emma tool you need to make sure the phone is running a high enough version of Android (before you replace it). Connect the phone to Windows while holding the Volume Down key. LED will go green. Select a service of at least build version 34.3.A.0.228, and Apply Service to phone. Disconnect, boot it up, go through Setup Wizard, turn it off.

Download Sailfish OS (or buy it if you haven't already) and the Sony binaries (for an older version of Android). Extract both into one folder.

Connect phone to Windows while holding the Volume Up key. LED will go blue. Run the flash-on-windows.bat script. Follow on screen instructions, then reboot phone into SailfishX.

Also, there are official instructions now.

Sailfish X, part 3

2017-Oct-06, Friday 11:46 am
chebe: (Default)
It's confirmed that you will have to use Windows, and Sony's tool Emma, to put Sailfish X on your Xperia X. (It's nice to see that Xperia X has been added to the flash tools list of supported devices.) So next step is installing that, and learning how to use it. Of course, you can try installing other ROMs now. You only have to wait for Sailfish X.

Sailfish X, part 2

2017-Oct-04, Wednesday 03:17 pm
chebe: (Default)
Sales have opened, if you are due a refund and you get the email offering you to exchange part of your refund for a voucher. Look at it, so close, and yet...

Servers are currently 502-ing when I attempt to login in to redeem my voucher. Downloads don't start for a week, so I suppose there's plenty of time...

But. If you happen to be at 404 this weekend, and need your Xperia X unlocked, but lack a Windows OS, I can help out.

edit
After two hours I finally got through to purchase my copy.

If you are in the refund scheme but didn't get an email about the voucher, search your email for 'Jolla tablet refund survey access link'. It's the same link for the voucher option.
end edit

Sailfish X, part 1

2017-Sep-29, Friday 11:54 pm
chebe: (HandAgainstGlass)
I'm preparing for SailfishX. It isn't on sale yet, but there's a lot to do before you get there. This is part 1; unlock the bootloader. On Windows 10. (I do like a challenge.)

First thing is first, Jolla are only supporting one model initially; the Sony Xperia X (F5121), single SIM version. And it needs to be network unlocked, so grab a SIM-free version.

The next part is also known as, how to void your warranty and factory reset your device while following Sony's official instructions. Doesn't that sound like fun? Note; this is not reversible.

Visit the Sony unlock bootloader page, read all the horrible notices, select your device from the dropdown menu, and click Continue.

Sony want your email address. They'll give you a keypad combination you can use to make sure your bootloader can be unlocked.
edit
1. In your device, open the dialer and enter *#*#7378423#*#* to access the service menu.
2. Tap Service info > Configuration > Rooting Status. If Bootloader unlock allowed says “Yes,” then you can continue with the steps below. If it says “No,” your device cannot be unlocked.
end edit
And a code to get your IMEI. They want that too. They'll email you a link to your own personal unlock code, and instructions on how to use it.

1. Download the Android SDK. You don't need Android Studio, I mean, you really don't, unless you want to write Android apps and spend the rest of your life installing massive updates.

2. I'm on Windows, so I need to get Sony's modified fastboot driver. Extract this, copy android_winusb.inf to C:\Users\$USER\AppData\Local\Android\sdk\extras\google\usb_driver, replacing the existing one.

3. Boot up your Xperia X. Prepare it;
Settings > About Phone > Build number (click on this quickly multiple times until it tells you you've unlocked Developer mode)
Settings > Developer options > USB debugging (enable)
Settings > Developer options > OEM unlocking (enable)
Turn off phone.

4. Hold down the Volume Up button on your phone, as you connect it via USB to your computer. The phone's LED will go blue.

5. On your computer go to C:\Users\$USER\AppData\Local\Android\sdk\platform-tools and run fastboot devices.

Possibility A. This lists your device with no errors, go to 6.

Possibility B. This lists nothing. Go to Device Manager. You will see an Exclamation Point over a device, called something like S1FastBoot. Open up it's Properties, then Upgrade Driver, search specific path on your computer, and point to the Sony fastboot driver from before (C:\Users\$USER\AppData\Local\Android\sdk\extras\google\usb_driver). This might work, but it probably won't, giving an error about a lack of signature and that the driver was probably altered. It was, by Sony. So now you have to Disable Driver Signature Enforcement temporarily.

Disconnect the phone. Hold down a Shift key as you Restart your computer. When it reboots it will offer you the Advanced Startup Options menu. Select through; Troubleshoot > Advanced Options > Startup Settings. Then you'll have to press 7 to select Disable Driver Signature Enforcement. Let it boot back into Windows. Go back to Device Manager and Upgrade Driver again. This time it should succeed.

Run fastboot devices again, and it should also succeed.

6. Time to actually enter the bootloader unlock key. Still in C:\Users\$USER\AppData\Local\Android\sdk\platform-tools run the command with the code Sony provided. -i 0x0fce is the manufacturer code. oem unlock is what you want to do. The rest is your device code.
fastboot -i 0x0fce oem unlock 0xABCDEF0123456789
(If you get a FAILED (remote: Command not allowed) at this point you probably haven't enabled OEM unlocking on the phone. Go do that.)

OKAY [ 0.188s]
finished. total time: 0.188s


This undramatic output confirms you have successfully unlocked your bootloader. And probably voided your warranty. And reset your device to factory state, wiping internal memory. Losing some of their keys, possibly disabling some of their hardware and optimisations. Unable to undo. And you still don't have root. But you're closer to a freer device. Right?

Mega Pro Mini 3.3V

2017-Sep-23, Saturday 10:00 pm
chebe: (Default)
I finally opened up my Mega Pro Mini 3.3V, long retired it turns out, for something. Luckily I had bought the necessary connectors at the same time, and I always have an FTDI breakout board handy. But things I needed to figure out;

You need to add Sparkfun to your "Additional Boards Manager URLs" in the Arduino IDE;
https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json

Then select your Board as "SparkFun Mega Pro", and Processor as "ATmega2560 (3.3V / 8 MHz)".

But also, that each of the pins in output mode only supply about 40ma. Not the 200ma these lamps require. *sigh* Back to LEDs!
chebe: (Wild)
I spent way too long trying to build a solution out of parts I had readily available before I discovered that Adafruit had exactly the thing I needed: the piOLED, tiny screen to attach to my Raspberry Pi Zero W. One of the examples even included what I was after; a way to display the ip address, in stats.py.

The script doesn't exit as cleanly as I'd like, so the first thing is to put the while True: loop into a try: and put the cleanup in the catch:
except KeyboardInterrupt:
    disp.clear()
    disp.display()


The tutorial also has instructions on how to run the script on startup; by putting it in rc.local
sudo vim /etc/rc.local
And add the call to the script, before exit 0, pushing it into the background;
sudo python /home/pi/Adafruit_Python_SSD1306/examples/stats.py &
Save and exit.

Cool, now we have a way to display the ip address of the pi so we can ssh in. But, there is nothing to turn it off again.

First thing needed is a python script to blank the screen. You can take a copy of stats.py and strip out everything except the setup code and the cleanup code. Cool, this works, kinda. It clears for a moment and then starts displaying again. This is because we haven't killed the processes doing that yet.

So, we write a script to do that. (Here I ran into some dash versus bash problems. Damn you dash, damn you.)
Something like;
#/bin/sh

pids=$(ps -ef | grep 'python .*examples/stats.py' | awk '{print $2}')

echo $pids | while read -r line;
do
    sudo kill -9 $line
done

sudo python /home/pi/Adafruit_Python_SSD1306/examples/blank.py


Great, this works wonderfully, when we manually invoke it. We're going to want it to run at shutdown too though. (Because, while power is still supplied to the pi, even though it's off, and the screen isn't updating, the old data is still displaying.)

This is not as easy as it should be. I basically wanted a rc-local for shutting down. I'm not the only person who has had this idea, so have a look here for a way to add shutdown functionality to rc-local.

Summary;
* Copy /etc/rc.local to /etc/rc.local.stop
* Edit /etc/init.d/rc.local, adding in extra info to # Required-Stop:, # Default-Stop:, edit the case statement to call do_stop in event of stop), and add the do_stop function (which is a copy of the do_start function changed to point at rc.local.stop).
* Delete the old rc-local daemon; sudo update-rc.d -f rc.local remove
* Pick up the new; sudo update-rc.d rc.local defaults

But, this alone isn't enough for Debian/Raspbian to pick up the changes. Enter systemd.
sudo vim /lib/systemd/system/rc-local.service
And add this line just after ExecStart;
ExecStop=/etc/rc.local.stop stop
Save and exit.

Now, stop the daemon, reload it, and then start it.
sudo systemctl stop rc-local
sudo systemctl daemon-reload
sudo systemctl start rc-local


One final thing, edit rc.local.stop to use the stop script instead of the start one. And don't push it to the background. Something like;
sudo /home/pi/Adafruit_Python_SSD1306/examples/kill_SSD1306.sh

Finally, when you reboot, startup, and all the other fun things the screen should behave nicely. Enjoy.
chebe: (AsciiC)
This is a fun one. I was playing with my Explorer pHAT and noticed that every time I Ctrl-C'd out of a script I'd get a message;

Broadcast message from root@raspberrypi (somewhere):

BCM 4 held low, system shutdown in 5 minutes


Broadcast message from root@raspberrypi:

The system is going down for power-off!


And yes, the pi would turn off. Every single time.

I don't know why the Explorer pHAT seems to pull BCM 4 low upon exit, when none of my other pHATs do. But I do know why that was triggering a shutdown.

I had also installed (though not in use) the Zero LiPo SHIM and the OnOff SHIM. They both install the clean-shutdown library that does just what it says, shuts down your pi when BCM 4 is held low.

It installs the cleanshutd service, but it didn't respond to my attempts to stop it, so I had to disable it.

In /boot/config.txt add;
disable_cleanshutd=1
Save, exit, reboot. Then you can play around with your Explorer pHAT in peace.
chebe: (Candles)
The Ikea Trådfri lights look very interesting. While not cheap, they are much more affordable than other wireless 'smart' lighting. They don't do RGB colours (yet), but you can control the colour temperature; ordinary neutral soft yellow, a warm orange, or a bright white. You can also dim the lights, and of course, turn them on and off. They don't do too much, but what they do they do well, and there don't appear to be any major security holes. But most interestingly, they use ZigBee, and seem to be built on top of a lot of open source stuff. Which means, there are already tools to play with them.

First thing you're going to need to do is get some Trådfri lights. They do have a starter kit, but I wanted the smaller E14 bulbs so I built my own (for not much extra). You'll need the Gateway hub, a control device (remote control definitely works, I don't know about using the dimming set, or motion sensor instead), at least one bulb, and have a lamp/socket to put it in.



Supplies; gateway, remote control, two E14 bulbs, and two lamp shades
Photo by chebegeek



The Gateway has a companion app to set everything up. You pair the app (your phone) to the Gateway, then you pair the Remote Control to the Gateway. Then you add the bulbs (pairing through the Remote Control) one by one. The app lets you arrange the bulbs into separate groups, or lump them all into one if you prefer. Once all that is done, it's time to build your own control interface.

Mostly I followed this excellent tutorial from the lovely Pimoroni crew.

sudo apt-get install build-essential autoconf automake libtool
(Or on Fedora;
sudo dnf install build autoconf automake libtool)

git clone --recursive https://github.com/obgm/libcoap.git
cd libcoap
git checkout dtls
git submodule update --init --recursive
./autogen.sh
./configure --disable-documentation --disable-shared
make
sudo make install


You're going to need the Gateway IP address. You can log into the router, or scan the network. The Pimoroni tutorial found their's at 192.168.0.10. I found mine at 192.168.0.20, so it probably jumps in steps of 10 until it finds an empty slot.
There is a Security Code on the base of your Gateway, you'll need to make a note of it.

The endpoint protocol is coaps:// and the port is :5684, followed by 15001 to control bulbs individually, or 15004 to control as a group.

A good way to start is by sending info requests to both endpoints;
coap-client -m get -u "Client_identity" -k "your_security_code" "coaps://192.168.0.20:5684/15001"
You'll get back an array of devices;
[65536,65537,65538]
It's a bit predictable. The first number is your remote control, the next two are bulbs, in the order you paired them.

coap-client -m get -u "Client_identity" -k "your_security_code" "coaps://192.168.0.20:5684/15004"
Also gives you back an array, but with the group ids, which seem much less predictable. (You can also find the group ids in the app.)

You can append the ids to the requests to get more information about each. Helpfully, there is an English description (i.e. "TRADFRI remote control", "TRADFRI bulb...", etc) returned in each.

The bulbs have a field "3311" with detailed state information. You can set parts of this to control the lights with -m put commands, e.g.;
coap-client -m put -u "Client_identity" -k "your_security_code" -e '{ "3311": [{ "5850": 0 }] }' "coaps://192.168.0.20:5684/15001/65537"
"5850" controls on/off and takes 0 or 1.
"5851" controls brightness, and takes values between 0 and 255.
"5709" and "5710" seem to work together to control the colour temperature. Valid values can be found by using the Remote Control, and then querying the state. The three main ones seem to be;
-e '{ "3311": [{ "5709":24933, "5710":24691 }] }' for bright white,
-e '{ "3311": [{ "5709":33137, "5710":27211 }] }' for warm orange,
-e '{ "3311": [{ "5709":30138, "5710":26909 }] }' for neutral yellow.


But this is all from the terminal. There is a nice python wrapper (with come convenience calls) if you want to start calling it from python, which is helpful if you want to start using python libraries for interfacing with hardware on your Raspberry Pi Zero W. But you'll find all of that in the tutorial.

There's also so much beautiful info in the thread that started all this. Have fun!



Ikea Trådfri lights controlled from Raspberry Pi Zero W
Photo by chebegeek

Page generated 2017-Oct-23, Monday 12:46 am
Powered by Dreamwidth Studios