Play Battleships on your SenseHAT with your Raspberry Pi

Dan Aldred has posted the code for a SenseHAT-based version of the classic game Battleships. Here’s how he describes it:

The program creates a random layout of boats, ammo and water. Use the joystick to select a location and then press Enter to fire a Torpedo.

If you miss you will here a splash of water, if you hit then you will hear the explosion. Else you may find an ammo dump. Each square is then coloured, blue for water, red for a ship and yellow for ammo. You will be updated n the number of ships left to destroy.

When you have used all your Torpedoes up or you have destroyed all the ships, then game ends and you are updated with your score. You can select to play again and a new random layout is created, or leave the game.

Great idea from Dan! You can download the Python 3 code here and see a video of it in action below:

 

Add audio to your Raspberry Pi Zero from the ground up

I don’t often link directly to YouTube videos – I prefer it when people build content posts around the videos to flesh them out a bit. However, this one was too good to pass up. The guys over at Tinkernut have posted a great tutorial video that shows you how to give a Zero a 3.5mm audio jack by hooking up some prototyping board to the GPIO and adding some common components. Take a look below:

Terrarium uses Raspberry Pi and NodeRED to grow orchids

Amsterdam-based Dendroboard forum user Corbosman has finally gotten around to having a Terrarium built and he controls the whole thing with a Raspberry Pi. His environment measures 120x60x110cm (48x24x42″) and it focuses on the growing and cultivation of orchids; eventually, it will house Panamanian dart frogs.

To control the environment, Corbosman and his brother (an electrician) have set-up two systems: one controlled by the Pi and one controlled by a series of timers. The idea being that when he needs to do something with the Pi, like change the Node-RED programming, he just switches it over to the timers.

The terrarium control systems are held underneath the the terrarium and the Pi is inside a DIN-rail case (numbered 3 in the diagram above). The Pi’s Node-RED software generates a touch-screen interface which he uses on a tablet:

All in all, a highly impressive system. You can read more technical details about the system and see more photographs here.

New HAT to generate motor-control pulses for the Raspberry Pi

Sean Hegarty has been in touch about a new HAT-format board that he and his company (CNC Design Ltd) have released for the Raspberry Pi. It allows clean, fast and accurate pulses to be created using simple ASCII commands. This is especially useful for “hardware designs where a variable frequency pulse is needed, but one that is the most popular is for driving stepper/servo motors that use pulse and direction lines”. It has an on-board Arm Cortex M4 processor running at 100MHz and dedicated direct digital synthesizer (DDS) pulse generators with 0.004Hz resolution for each channel. The HAT stack is capable of up to 4 individual pulse train outputs and also has a bunch of other features that you can read about here. The full package is £55+VAT and you can get the boards from their website.