|Story location: Home / computing / raspberry_pi /|
I first used a Raspberry Pi when I was working in Leicester and I bought one for home not long after that. I set it up as a file/media server and it has been sitting in the front room quietly doing its job since then.
Last year I bought a Pi 3 and an electronics starter kit (which consisted of a breadboard, LEDs, switches and various other components) so I could learn how to connect things to the Pi.
A few weeks ago I was given a NodeMCU development board (my friend Tim has already written about some of his experiments with his).
I followed the instructions on flashing the firmware and getting a script running. For some reason the ESPlorer software doesn't seem to behave well on my computer. It usually takes several rounds of restarting/resetting/reconnecting before it will agree to communicate with it. The command line tools have no problems, neither does CoolTerm. After a day when it felt like I was spending half of my time struggling to get ESPlorer to connect properly, I decided to ditch it and use the nodemcu-uploader command line instead.
The first thing I wrote was the Hello World of the microcontroller world: the flashing LEDs. The next stage was to use the serial ports to connect the Raspberry Pi and the NodeMCU together.
Setting up the Raspberry Pi Serial Port
By default, the serial port on the Pi is configured to be used for a serial console , mainly for diagnostics. To use it for other things, you need to disable the console. There are lots of different instructions to do this but for the Pi 3 it boils down to editing the /boot/config.txt file and adding the line
followed by editing /boot/cmdline.txt and removing the
entry. After rebooting the Pi, the GPIO pins 14 & 15 should be available for the serial port.
Writing the script for the NodeMCU
I took my flashing LED script and modified it to listen to the serial port. Sending 'r','g' or 'b' will light up the respective LEDs, any other character will turn them off. If the following script is saved as serial.lua, it can be uploaded to the NodeMCU using
python nodemcu-uploader.py -port /dev/serial0 upload serial.lua
as long as the NodeMCU Uploader has been installed first.
-- Listen on the serial port for a colour. -- Toggle the colour of the LED. green=2 blue=1 red=3 gpio.mode(red,gpio.OUTPUT) gpio.mode(green,gpio.OUTPUT) gpio.mode(blue,gpio.OUTPUT) -- Start with the LEDs off gpio.write(red,gpio.LOW) gpio.write(green,gpio.LOW) gpio.write(blue,gpio.LOW) uart.setup(0,115200,8, uart.PARITY_NONE, uart.STOPBITS_1, 1) uart.on("data",1, function(char) if char=="r" then print("red") gpio.write(red,gpio.HIGH) gpio.write(green,gpio.LOW) gpio.write(blue,gpio.LOW) elseif char=="g" then print("green") gpio.write(red,gpio.LOW) gpio.write(green,gpio.HIGH) gpio.write(blue,gpio.LOW) lighton=2 elseif char=="b" then print("blue") gpio.write(red,gpio.LOW) gpio.write(green,gpio.LOW) gpio.write(blue,gpio.HIGH) else print("Off") gpio.write(red,gpio.LOW) gpio.write(green,gpio.LOW) gpio.write(blue,gpio.LOW) end end,0)
The script can be run using
python nodemcu-uploader.py -port /dev/serial0 file do serial.lua
Getting the Pi to talk to the NodeMCU
I connected the RX GPIO pin on the Pi to the TX pin on the NodeMCU, and vice versa. The easiest way of powering the NodeMCU was to use the power out pins from the Pi. I found that connecting the 5V out to Vin on the NodeMCU worked reliably. If I had the Pi plugged into a good quality USB power adaptor then I could also get it to work by connecting one of the 3.3V pins of the Pi to one of the 3.3V pins of the NodeMCU board.
The script uses the serial port library, which can be installed using
sudo apt-get install python-serial
The Python script is fairly simple and just cycles through the LEDs a few times. The third line runs the lua script, in case it wasn't already running. There isn't a pause between cycling between the LEDS but the serial timeout is set to 1 second and the port.read(100) command attempts to read 100 bytes. Since there should only be the colour names being returned, this automatically adds a 1 second delay. This might not be very good programming practice but it was the easiest way of incorporating reading a variable length response and adding a pause all at once.
import serial port = serial.Serial("/dev/serial0", baudrate=115200, parity=serial.PARITY_NONE, timeout=1.0) port.write("dofile('serial.lua')\r\n") for i in range(1,10): for c in ['r','g','b']: port.write(c) r = port.read(100) print(r)
This first demonstration is pretty trivial, although it took a few days of trial and error to get everything working. In due course I'll experiment with connecting different sensors to the Pi and NodeMCU.
I think my next step is to use Java on the Pi to do the same thing. I have had a quick look at Java serial port stuff and it isn't as straightforward as Python but since I do most of my programming in Java these days, it will be useful to know how to do that.
|Story location: Home / food_and_drink / a_to_z /|
For the letter 'B' I decided to do a version of a traditional Bulgarian Christmas loaf. I had originally intended to make it over Christmas but I didn't find time to do any baking, and since we had lots of cakes and chocolates to eat, we didn't really need more bread.
(For the bread)
- 2 cups of bread flour
- 2 tsp yeast
- 2 eggs
- 50g softened butter
- ½ cup water
- 1 tsp salt
- 1 tablespoon honey
(For the glaze)
- 1 tsp of honey
- a few drops of water
Mix the water and honey a few drops at a time until the honey is a pourable consistency.
I put all the bread ingredients in our food mixer, with the dough hook, and let it mix for a few minutes. Since this a brioche type bread, the mix was very wet and a bit sticky, which made it difficult to handle and shape.
I broke the dough into equal weight pieces, rolled them into balls and put them in a round tin to prove.
After they had risen, I carefully brushed them with the honey mixture. It was baked in a pre-heated oven (gas mark 5) for half an hour. I started it off covered in foil, but took the foil off after the first 15 minutes.
Verdict: a soft slightly sweet brioche with a honey flavoured crust. Definitely one to try again.
I went back to the German Market again and picked a random stall to buy my lunch. This time it was one of the Pretzel stalls. The salami pretzel sounded good so I bought one of those.
The pretzel was pretty much what you expect: soft, chewy and very salty on top. I had change left so I thought I would try a dessert next. The choice of desserts was reasonably wide and included pancakes, sweets, cakes, marshmallows or chocolate coated fruit kebabs. The dice took me to a marshmallow stand.
I chose an orange and a gingerbread one. The marshmallow is softer and stickier than the sort you get in bags, and sits on a small waffle or wafer-like disc.
The German Market is in full swing in Birmingham and I am still using the random number app to choose my lunch.
The dice took me to a schnitzel stand which offered a choice of different meats. I let the dice decide and came away with a chicken schnitzel. I also got some chips to go with it.
I had asked for the mushroom sauce and I think they gave me the curry sauce but it was still good, and went well with the schnitzel.
Half metre sausage
The choice was a bit easier this time. The dice chose the half-metre bratwurst stand so I didn't have any extra choices to make. I didn't let the dice choose my condiments, I added half ketchup and half mustard.
The sausage was fine but the bread was a bit chewy. Although it looks a lot of food, I still felt hungry afterwards.
This was another 'make room in the freezer' baking session. I had more grated pumpkin in the freezer, along with some 'shop damaged' bananas (6p for a bag). I defrosted them and made two cake mixes. My idea was to pour them in opposite ends of a baking tray, giving the middle a swirl so the ends were one type of cake and the middle had both combined.
The original recipe was based on the pumpkin cupcakes. I beat together 175ml of vegetable oil, 3 eggs and a teaspoon of vanilla extract, then divided the mixture in two.
In one half I added the pumpkin cake ingredients (but using cranberries instead of sultanas):
- 85g golden caster sugar
- 100g of grated pumpkin
- 50g cranberries
- 1 tsp cinnamon with ½ tsp of mixed spice
In the other half I added
- 85g of drinking chocolate powder, with an extra tablespoon of sugar
- 100g mashed banana
- 50g sultanas
Both halves also had
- 100g self raising flour
- ½ tsp of bicarbonate of soda
I poured the two batters into a 10x6 inch tray. I expected the cakes to take about half an hour at gas mark 4 but it was well over ¾ hour before the middle stopped being liquid.
When the cake had cooled, I made a lemon juice icing, slightly runny so I could drizzle it over the top.
I took some of the cake to work to share (since that was where the hot chocolate powder came from, it was only fair to do that). People seemed to like it - I got favourable comments from people, someone even noticed that I had used an oil based recipe. Both cakes were definitely worth doing again.
The German Christmas Market returned to Birmingham last week. We popped out for an inaugural pint or two when it opened but this week I decided to get some food. Instead of using the Wheeldecide website, I used a random number generator app on my phone to choose which of the many food outlets to choose.
I found myself in front of a chalet-style take-away which had a range of different menu items all based around burgers, potatoes and mushrooms. Instead of letting the dice choose how much I ate, I went for the full menu since I didn't want to end up hungry.
The garlic sauce was a bit too strong but the meal itself was good, as was the wheat beer.
Earlier this year I was watching Saturday Kitchen and they were showing one of the many regular clips from Rick Stein. This was from a series he did in Eastern Europe and it gave me the idea to try to do another alphabetical cooking challenge. I intend to take each letter of the alphabet and cook something from a country or region beginning with each letter.
Originally my plan was to cook a meal but we were recently at a barbecue where the husband was Algerian and his family had provided most of the food. There was a yellow bread which went down really well. When I got home I looked it up and found some recipes.
Khobz El Dar: Algerian Semolina Bread
I took inspiration from a recipe from food.com but I reduced the quantities a bit. Since the bread we ate didn't have seeds on or in it, I left those out.
My bread took a long time to rise (I think there were problems with the yeast) and the bread had a slight sourdough taste to it. I had baked with semolina before but this was the first time I had done a bread which was mostly semolina flour. My version wasn't as good as the one we had at the barbecue but it was my first attempt. If I try again, with fresher yeast, it might come out better.
When we scooped out the pumpkins to make Halloween lanterns, I grated and froze the flesh so I could try cooking something with it. The pumpkins which are sold for lanterns are usually a lower quality and aren't recommended for eating so I thought I would start with something where the pumpkin isn't the main flavour, so I could probably get away with a lower quality ingredient.
I found a recipe for cupcakes. It was pretty much a carrot cake but using pumpkin instead of grated carrot. The recipe called for grated orange zest but I didn't have an orange so I left that out.
I tried one of the cakes last night, when they were still a bit warm. It tasted ok but that was before I had made the icing. Tonight's cake, with a generous layer of cream cheese frosting, was definitely an improvement.
I carried on trying out different porridge recipes this week. A couple of highlights are below.
Apple and Blackberry Porridge
When I made the apple puree a few weeks ago, I bottled and froze the juice which collected in the bottom of the pan. I used it to make an apple and blackberry porridge.
Tropical Fruit Porridge
I used coconut water instead of milk, and added some tropical fruit mix.
I only had time to try 4 different porridges this week. I'm going to be away on Friday so won't have chance to make anything.
Monday: Bacon and Syrup
Yes, you read that right. I don't like mixing sweet flavours with meat and consider pineapple with gammon or on a pizza to be a very poor choice. I decided to be adventurous and try a sweet bacon porridge. Mistake. I could still taste it even after a cup of tea and brushing my teeth.
Tuesday: Apple and Blackberry
After last week's Apple and Cinnamon porridge, I decided to try an Apple, Blackberry and Cinnamon porridge, using extra cinnamon. This was better than the plain apple one, although the blackberry seeds added a bit of a crunchy texture.
Wednesday: Lemon Berry Porridge
This was inspired by a recipe from the World Porridge Making championships. I used a mixture of frozen berries (blueberries, blackberries, wild strawberries and red gooseberries) which were mostly picked in our garden, with about a tablespoon of added lemon juice. I cooked the porridge in water instead of milk then added the fruit.
I tried the porridge first, before adding any extra sugar. I don't think it needed any. The fruit were quite sweet and the lemon juice balanced it out with some added sharpness.
Thursday: Chocolate and Coconut
This was inspired by the flavours of the Bounty chocolate bar. Since dessicated coconut can be quite 'bitty', I microwaved some in water last night then added it to the porridge this morning, along with some drinking chocolate. The coconut still had a bit of bite to it. I have tried coconut in porridge several times before and there are always some hard bits so I probably need to boil or simmer it for quite a long time to stop that happening.
I have porridge for breakfast fairly often but now that the weather is starting to get cold, it's probably time to make it my regular breakfast now. Most mornings I just add some dried fruit and sometimes some honey but this week I thought I would try a different flavour each day.
Monday: Peanut butter and Cranberry
Since it is World Porridge Day, I decided to do a different porridge each day this week. I only decided this after I had already left for work so this morning I used what I had available: a tub of dried cranberries and a small pot of peanut butter.
Tuesday: Dried raspberry
While I like raspberries, the taste didn't get into the porridge and they were very 'bitty' to eat.
Wednesday: Apple, cinnamon and brown sugar
I have mentioned before that most cake recipes don't use enough cinnamon. Unfortunately I made the same mistake myself and didn't add enough to the oats. Next time, I will add more and possibly use sweetened cooked apple instead of chopping a fresh apple into the porridge.
Thursday: Strawberry Porridge
We have a bag of frozen strawberries so I put some in a tub to defrost in the fridge overnight and added them to the porridge after I had cooked it. I then gave it another 20 seconds in the microwave to make sure the strawberries weren't too cold.
Fresh strawberries don't always have much flavour and I could probably have added more but this was ok.
Friday: Nutella and Peanut Butter
This used to be a favourite of mine but I hadn't had it for a while. We recently bought a jar of nutella so I made it again today. This was possibly my favourite of the week.
A few weeks ago I decided to try somewhere different for lunch. I found a website called wheeldecide.com which can randomly choose from nearby restaurants or take-aways. I decided to use it to choose where to go for lunch.
Week 1: Full Stop Sandwich
This place was a bit of a walk. I didn't know where 'New Town Row' was and had to look it up on a map. When I got there it was almost empty but while I was paying for my sandwich it started to fill up. I chose their 'sandwich of the day' which was pork and stuffing. It came with a very thick gravy and a few pieces of crackling.
Week 2: Tuckers
I walk past this place, in the Minories, fairly regularly. It does sandwiches and hot food. I decided to try the all day breakfast for £5 which had bacon, egg, sausage, black pudding, beans, toast, hash brown and tomatoes. It also came with a cup of tea. It was good value and very filling.
Week 3: Wasabi
I needed to walk to the shops to pick up something I had ordered from PC World so I put the postcode for the High Street into Wheeldecide. It kept coming up with places in the Palisades, which is closed for refurbishment, so I decided to go to Wasabi, in New Street Station, instead.
I had been wanting to go there since it opened. I chose one of their salmon sushi boxes, which came with a couple of spicy chicken skewers.
They have a wide range of sushi and bento boxes, with rice and noodles. I'll have to revisit to try something else.
|Story location: Home / Blog / food_and_drink /|
I made a second batch of the apple sauce and drinking chocolate brownies. This time I added a handful of dried cherries to the mix. I also used half apple pureé and half olive oil, since I only had half a cup of apple pureé in the fridge (the rest is in the freezer).
When the brownies came out of the oven, I sprinkled 50g of plain chocolate over the top and waited for it to melt before spreading it over the top.
I took the cakes to work the share out and the everyone seemed to like them.
We have been fans of the Great British Bake Off since it first started and occasionally I cook something inspired by the programme. This week they did a Fougasse, which I hadn't heard of but looked good. The version on the programme was flavoured with herbs but I thought I would start with a plain version then try flavoured ones another time.
I followed the bread part of the recipe precisely, scaling it down a bit since I didn't need two loaves.
- 300g (2¼ cups) of bread flour
- 6g salt
- one sachet of yeast
- 2 tbs extra virgin olive oil
- 200 ml warm water
The method involved adding ¾ of the water at the start, then slowly adding the rest, using a food mixer with a dough hook. I followed it to the letter, including the 8 minute mixing time.
I actually split the dough in 2, adding extra flour to one half to use for a pizza base. The other half I left as-is and shaped into an approximate leaf shape and cut down the middle and diagonally from the centre.
After about an hour or so proving, I transferred the bread, still on the baking paper, onto the pizza stone and baked it (at gas mark 7) for 15 minutes.
It looks a bit irregular (or informal as Mary Berry might say) but that was mainly because it slid off the tray while I was getting ready to transfer it to the pizza stone. We ate it with some dips. I made the cheese and courgette dip again, but this time using cream cheese and pecorino instead of goats cheese. The fougasse was good. The outside was crispy while the inside was soft and fluffy. The dip was cheesy and went well with it.
Next time, I will add some extra flavours to the bread. Possibly garlic and chilli or parmesan/pecorino. We have some fresh herbs in the garden (and more chopped in the freezer) so I could also do Paul Hollywood's herb version too.
|Story location: Home / Blog / food_and_drink /|
We have a glut of hot chocolate powder in work, left over from when we used a different drinks machine. I was talking to a colleague in the kitchen and I wondered whether I could use some of it to make cakes. I decided to take some home to make an experimental batch of chocolate brownies. If they were any good, I would make some more to take back to work to share.
Every now and then I use apple sauce in recipes, since it can be used to replace some or all of the butter. We recently bought an Instant Pot, which we use several times a week as a pressure cooker, slow cooker, bread proving pot, or sometimes just a giant saucepan. It is very useful and I fully intend to blog a bit more about it in the future.
We had recently been given a bag of apples from the tree in Emma's Auntie Val's garden. I peeled them, cut them into big chunks and put them in the instant pot with a splash of water. I cooked them on the 'Soup' programme for 15 minutes and they had cooked down to a smooth pureé, there was no need to mash or liquidize afterwards.
I looked up some brownie recipes to get a feel for the quantities, then decided to use the hot chocolate powder to replace both the sugar and cocoa powder.
- 1 cup of apple purée
- 3 eggs
- 1½ cup of hot chocolate powder
- a pinch of salt
- 1 cup of plain flour
- 1 teaspoon of baking powder
- 50g of plain chocolate, broken into chunks
- Heat the oven to 180C or gas mark 4. Grease and line a 9 or 10 inch cake tin.
- Mix the apple pureé, eggs and hot chocolate powder together
- Mix together the flour, baking powder and salt and sift into the wet mixture. Fold in.
- Stir in the chocolate pieces.
- Pour into the tin and bake for about 30-40 minutes, until a skewer comes out clean.
Unfortunately I had to leave the house before the brownie was fully cooked so I turned the oven off and left it in while the oven cooled. When I got back, the brownie was properly cooked though, possibly a bit over-cooked because it wasn't moist and squishy inside.
There was absolutely nothing wrong with the flavour though. Chocolate cakes do need a lot of cocoa powder or they just end up like brown sponge cakes. This was probably about right. I tried a square, then remembered that I needed to take a photo to put here. After taking the photo, I made a coffee and ate the second piece. If there is any cake left on monday, I'll take it to work, but I'll probably have to make another one to make sure there is enough to go round.