Sunday, July 19, 2015

Ansignan Aquaduct

I know I don't often post about things I find whilst out with Beaky but this find was so unexpected, and so cool, that I wanted to make sure I captured it properly.

One of the best random finds yesterday coming home was a Roman aqueduct. I was coming down over the hill through the village of Ansignan and passed a sign to "Roman Aqueduct" at about the same time as I realised I was looking at it down over the hill.


This needed a closer look so I turned around and followed the signs to the little parking area nearby, passing the aqueduct as I did.



I parked Beaky, and wandered over for a closer look, realising as I did so that I could hear running water.  Yes...it actually has water crossing it!






I walked down alongside the aqueduct toward the river it crosses, and saw the archways through the structure.




  Not only does it carry water over the river, but it also includes a foot bridge!



Yes, that’s right - *under* the aqueduct part, you can walk into one of the arches and the structure is ‘hollow’. Turn to follow the aqueduct and you can walk under it, and over an integral bridge across the river.




Amazing design, and not only still standing but still in active day-to-day use: it’s on a cycle path and the bicycles can cross on it (not sure I would have risked taking Beaky through…)

Sunday, May 03, 2015

Raspberry Pi - Plantfriends

This project has taken a few weeks to come together, not least because of the range of parts I needed to order.

Plantfriends is a neat project that allows you to monitor the soil moisture of plants, along with temperature and humidity.  The information is collected by a raspberry pi base station, which uses a database to store the data and initates emails when there is a problem.  The latest status and summary of each plant can also be viewed via an Android app on a smartphone.

Sounds complicated?  Well....yes, it was.  

The project involved:
physically building the circuits for three sensor nodes and the base station (although the latter is much more simple!)
- programming the Moteino boards
- setting up the operating system on the Raspi
- setting up php server on the Raspi
- creating a database
- running a python script on the Raspi to read the incoming data, and populate the database
- setting up an android app on the phone
- creating some cases for the sensor nodes.  In Lego, obviously.

I built one sensor first to get to grips with how things were supposed to work.  As it turned out, the major obstacles were the various codes, not with the hardware!

The sensor node:


The red board if the moteino; the thing on the left is the soil moisture sensor.  The humidity and temp sensor is mounted on the underside of the board.  And battery pack as well (4x AA batteries).  Oh, yes, the sensor nodes also monitor their own power supply, and can warn once the batteries need changing!

The base unit:


This is just a temporary case for now.  Moteino receiver on the right (hanging out the case!).  Also added is the switch circuit I added (I'll cover another time in more detail).

The sensor nodes inside the Lego cases, and with the moisture sensor probes in the soil:




Problems and Solutions

Here be techie stuff.  

Generally, Dickson's guide was dead easy to follow.  Every step of the physical build was photographed and annotated, and pretty much idiot proof.

Programming the Moteino boards took some troubleshooting, as I was using a later model board with a different radio transmitter (the RFM69).  This meant some new libraries were needed and a few changes to the basic code as the command lines for using the radio are different.  Still, nothing a little Google-Fu couldn't resolve.

Setting up the Raspi raspian OS was easy enough.

Error with ttyAMA0 permission denied


ls -l /dev/ttyAMA0 will show the owner (root) and group.

sudo adduser pi tty

Log back in to take effect.

Serial device disconnected


raise SerialException('device reporst rediness to read but returned no data (device disconnected?)') serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected?)

Run
ps -ef | grep tty

If the output looks anything like

root      2522     1  0 06:08 ?        00:00:00 /sbin/getty -L ttyAMA0 115200 vt100

Then you need to disable getty from trying to send data to that port.  In order to use the Raspberry Pi’s serial port, we need to disable getty (the program that displays login screen) by find this line in file /etc/inittab

T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

And comment it out by adding # in front of it

#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100)

To prevents the Raspberry Pi from sending out data to the serial ports when it boots, go to file /boot/cmdline.txt and find the line and remove it

console=ttyAMA0,115200 kgdboc=ttyAMA0,115200

Reboot the Raspberry Pi

Gmail security for login


Python script unable to log into email account.
This was linked to problem with gmail security and apps; disable as per messages on gmail account here: https://www.google.com/settings/security/lesssecureapps

Database not being populated despite everything seemingly okay


Avoid using hypens in the node name.
Add the node info using the admin.php script!

Check the python script is running


ps aux
Look for process with plantfriends.py

Setting the USB debug on Android phone

I think this took the longest to work out, and I didn't take notes the whole time, but the fun was working out what code was needed! 

Wednesday, April 29, 2015

RaspberryPi - Cooking up a case (Follow-up)

Following on from the case I made a few weeks back, I was able to get some chestnut wood cut to size.

This one was drilled much as before -
  • four 6mm holes in the corners for the spacer nuts and feet
  • four 4mm holes in the base piece to attached the Pi (this one being a RPi-B).  Although the circuit board is drilled with 3mm holes, the 4mm ones in the base allow a little play to avoid bending the board.
  • one 16mm hole in the top for the new switch.
The Pi has no on-off switch, and powering off the GPIO pins is not advised; so I bought a small circuit from mausberry circuits.  This little circuit sits between the power supply and the MicroUSB power input on the Pi.  Two connections to the GPIO allow the power off and reboot all from the same switch.

The switch was one of these from Adafruit. Complete with blue LED light when powered up, this was easy to connect up.

The final working board looks pretty neat, if I may say so myself.
 

Sunday, April 05, 2015

Raspberry Pi - Can you hear what I hear?

The first project I wanted to use the Pi for was a media centre.

I wanted to:
1/ Stream music from my NAS drive via wifi
2/ Listen to inernet radio via wifi connection
3/ Connect output to my TV so that I could play through my DVD player/Surround Sound system

In the end, 3/ was replaced by "Connect directly to Surround Sound using 3.5mm audio jack".

I choose Volumio as the system as it seemed to do what i needed it to do.

Download and install Volumio...

Download Volumio for Raspberry Pi from here.

Burn ISO file to SD card using Win32DiskImager.

Put SD card in Raspberry Pi, add LAN and power up from PC's UB port (just initially).

Set up wifi...

On the basis of other reviews, I ordered a Edimax EW-7811UN Nano USB Adapter.


Based on the following threads:

Boot the Raspberry Pi without the WiFi adapter plugged in.

Open a Terminal session by clicking on the LXTerminal icon, and enter the following command into it:

$sudo nano /etc/network/interfaces

This opens an editor screen of the wifi configuration file you need to change.
Edit the file to include at the end:

allow-hotplug wlan0
auto wlan0
 
 
iface wlan0 inet dhcp
    wpa-ssid "ssid"
    wpa-psk "password"

..where ssid and password are replaced with mine…

When you have finished press [ctrl]x. This will ask if you want to save the modified files.

Shut down the Raspberry Pi
sudo shutdown -h now

Remove the LAN cable
Plug the WiFi adapter in
Power up...

The Raspberry Pi should connect using the WiFi adapter as it boots up.

Conneting the NAS drive...

I had some problems with getting the Raspberry Pi to find the NAS drive on start up.  I could add it through the Volumio GUI, but it wouldn't mount the drive on start up.  It took some playing around to get a solution that worked, especially some of the fstab file tags were giving errors....still, the following worked in the end.


sudo apt-get install cifs-utils
sudo mkdir /mts/NAS/SOME_NAME


sudo nano /etc/fstab

Add the following line to the end of the file:
//IPADDRESS_OF_NAS_DRIVE/NAS_FOLDERNAME /mnt/NAS/SOME_NAME cifs username=*****,password=*****,ro,users,auto,user_xattr 0 0

...where ***** is replaced by the Pi's username and password for the NAS drive.

Save, exit.

Confirm using
sudo mount -a

Reboot.

Audio output...

Finally, I realised that there was no need to run the connection via the HDMI cable to the TV, then output via optical cable to the surround sound system...as the Raspberry Pi has an 3.5mm audio out jack, and the surround sound has an input for this...


To setup Output to Audio Jack instead of HDMI, I ran the command:
amixer cset numid=3 1

The last digit is the key one; 1= analogue (audio jack); 2= HDMI and 0=automatic(maybe I could have used this?)

Anyway, it works :)



RaspberryPi - Cooking up a case

Inspired by this instructables project I thought I would have a go myself and upgrade the old Lego one.

The final case:



I had most trouble finding a couple of pieces of wood; in the end I went for something a little tougher than balsa (but not much) a a stop-gap until I find something more like the oak in the original project.

All the hardware parts were from the local Leroy Merlin store, a large DIY store that sells hardware in a 'pick and mix'.  I ended up with few false starts on the hardware; this outlines the final design. I actually made two identical cases, as I have a second pi on order for another project (so the photos may show both!)

Parts



Wood, 190mm long, 102mm (4") wide, 3mm thick, 2 off.


To hold the case together:
Bolts, M6 20mm, 8 off.
Washers, M6, 8 off.
Coupling nut, M6, 30mm long, 4 off.
Plastic caps, M6, 4 off.

To mount the Raspberry pi board:
Bolts, M3, 16mm, 3 off.
Nuts, M3, 6 off.
Washers, M3, 6 off.

Assembly

The wood parts were marked and cut out.  The pieces are quite a bit bigger than I really needed for just the basic Raspberry Pi - I wanted room to mount a few extra internal boards for future projects.  This case *just* allows access to everything - see 'for nest time' at the end for more comments.

Edges lightly sanded to remove sharp edges.

Four 6mm holes drilled 16mm in from each edge, and the two 3mm holes drilled based on the mounting hole in the Raspberry Pi.  I have the Model A board; no idea if later versions have the same layout.

Adding the hardware

On the base piece (with the 3mm holes), add one M6 bolt with a asher either side of the wood, and screw into the coupling nut.






The plastic caps act as little feet to protect surface the Pi is on:



With all four corners done, add the M3 bolts for the board mounting.  Washer either side of the wood and add a second nut to hold the circuit board off the wood:


Add a washer, the slide the board onto the bolts and add nut to hold in place:


Add the top of the case, using a washer under the wood, and an M6 bolt in each corner.

And done!

If I made another one...

The coupling nuts look nicer than a stack of nuts used in the original design, I feel, although I was lucky to find some the right length.

The thinner material can split when drilling, take care!  I put this down to user-error as much as anything.

The wood used is okay for a proff-of-concept, a thicker piece would look better and as soon as I find something I'l replace it.  The bolts used allow for easy changing of the wood pieces; indeed you could easily use plastic or even ceramic tile.

Access to the board is a little tricky...you can get everything plugged in with the case assembled, just.  the LAN cable needs a pencil to press the release tag, and putting the SD card in is an exercise in dexterity.  However, this is intended for a Volumio media driver, so will only need power and audio connections once configured.  

Friday, February 27, 2015

Smarter than the average vacuum cleaner

Me: So, George, if you are just going to stay in the spare room when you do a cleaning run, I'll just have to move you and start you off in the kitchen.
George: Beep?
Me: Yes, now get on with it.
George: Beepbeddlebeep! /trundles around a bit exploring the maze of boxes.
Me: /Does stuff
George: / Finds his way out of the lounge
Me: I suppose my lounge does resemble a rat maze designed to test intelligence.  Maybe you are smarter than you look.
George: BeeburpPleaseHelpRoomba
Me: What now?  /goes off to search
George: I eated a sock...

Wednesday, December 24, 2014

It's a Lego Advent-ure: Epilogue

BAMPF!

OK, how did I get here?

Good question...I'm not sure myself.  Anyway, no more nonsense, just a message to wish everyone daft enough to read to the end of the Lego Advent-ure a merry Christmas and best wishes for 2015.

PS All the models came out of the Lego CITY Advent calendar 2015 on the day it was shown. I had no idea what was going to appear on any given day.  Only the ponies were added from my own collection.

Steve/Wily/Indy

It's a Lego Advent-ure: Day 24

BMAPF!

"Ho! ho! ho!" laughed Santa as he arrived.

"Aren't you a little early?" asked Captain George, "NORAD has you somewhere west of Australia at the moment."




"I took a detour to get here on time" replied Santa.  "Who wants a cookie?"

"WE DO!" cried George and George.


"We had PONIES and MOTORBIKE and COOKIES" said George.  "Bestestest Christmas ever!"

Everyone laughed.


"Merry Christmas everyone!" the Lego Adventurers said together.

The End.



Tuesday, December 23, 2014

It's a Lego Advent-ure: Day 23

BAMPF!

"What is it this time?" George asked in a bored voice.

"Nothing you will be interested in" replied George.  "Not at all."


"HOT DAMN!!!" George yelled.

"Dibs on first ride!"

"We shall call it....BEAKY!"

"That's a stupid name for this bike.  It has no beak."

"It's that, or we call it George."

"Beaky it is then."


Monday, December 22, 2014

It's a Lego Advent-ure: Day 22

"I think the only thing missing now would be tree to put the gifts under" said Officer George.

SPROING!


"Sproing?" said Batwoman.

"Yup.  Sproing." George replied, looking that the pretty little Christmas tree that had sproinged up from under the floor.

"Makes a change from Bampf."

"Don't you have a plane to catch?" George asked Captain George.

"You must be thinking of someone else" Captain George replied.