Tag Archives: Uncategorized

Teaching literature with Raspberry Pi

via Raspberry Pi

Last week, checking out posts people had made on our Facebook page and the projects they were telling us about, one in particular caught my attention. Sarah Roman, a high school English teacher from New Jersey, had written:

Our English class is going to be using the Raspberry Pi in order to build book-based video games, incorporating Scratch, Sonic Pi, and Python. The students are incredibly excited […]

There was a link to an Indiegogo campaign; we love to see Raspberry Pi used creatively outside of computing lessons, so I clicked on it. A minute of video opened with the title “English Classroom”, but it didn’t look like my high school English lessons. Students work around computers, ignoring the camera as they concentrate intently on… wait, is that Minecraft?

We got in touch with Miss Roman to find out more. She intends (for starters) to get students in her Junior Honors class (15-16 years old) building Pi-based games consoles with games that draw on their reading of Dracula by Bram Stoker, and she is raising funds to kit out her classroom with Raspberry Pis and accessories. The students will use Scratch, working collaboratively to create their own graphics, sounds, and housing for the console. Older students will be using the Raspberry Pis in their study of William Faulkner’s As I Lay Dying. Of course, these plans are only the beginning of the road for the Pis, both within and beyond Miss Roman’s classroom; her project proposal notes that there could be an opportunity to work with other instructors to show them how they might use Raspberry Pi in their teaching.

English Literature students

This isn’t the first time that Miss Roman has introduced video games to the English Literature classroom. Last year, Juniors reading William Golding’s Lord of the Flies worked in groups to build the island where the story is set from the imagery evidence they found in the text, adding significant quotes and moments to it via signposts and books; putting each student group into the same Minecraft world allowed them to explore each other’s work. Students were thrilled to use information from the book to build their own islands, and would sigh when the class came to an end. Miss Roman says,

Essentially, the Pi is helping me to integrate fiction and nonfiction, different literacies, and boost creative thinking […] I’m extremely happy with the Pi, and I’m sometimes staggered by the applicability it has for my classroom. I think that complex texts and ideas deserve projects that offer complexity as well, and by opening avenues of this kind for students, they have the ability to understand texts in ways that haven’t been previously accessed.

We’re excited to learn about Raspberry Pi being used in this way, and we hope that this crowdfunding campaign garners plenty of support – we’d love to hear more from New Jersey as this project takes off!

The Benton Park Live Coding Orchestra

via Raspberry Pi

We’re always really excited to see the resources and tools we make being used by kids in school. This video is from Benton Park School in Leeds, where a Sonic Pi orchestra put on a live coding performance recently. You can see setup, practice and some of the performance itself here.

I first watched this with Sam Aaron, who created Sonic Pi, looking over my shoulder, and we were both giggling with glee.

If you’re a teacher and you’d like to get something like this going in your own school, but don’t know where to start, why not apply for one of our free CPD sessions at Picademy?

And if you’d like to hear more from Sam, he’s going to be live-coding some of the music for the evening party at our upcoming Big Birthday Weekend – I hope you’ll be joining us!

Handheld games console – for REAL dummies

via Raspberry Pi

Here is the most rubbery review presenter we’ve ever met. Bryan Lunduke is here to show you how even a complete beginner whose hands are made from foam can build a games console from scratch, using a Raspberry Pi.

A tip, Bryan. I know you do not have hands that work (or, presumably, fingernails); but you’ll find that Pibow you’re using looks EVEN BETTER if you peel the backing paper off each layer!

Big Birthday Weekend – what’s happening, where and when

via Raspberry Pi

More than 1000 of you have signed up already to come to our Big Birthday Weekend at the end of February. Tickets for Saturday are now sold out, but there are still about 80 left for the Sunday event.

We’ve had lots of excited email from people who are coming, who want to know more about what we’ll be getting up to. Mike Horne (who many of you know as Recantha) and Tim Richardson, who run the Cambridge Jams and who are doing the lion’s share of the organising for this event, have been kind enough to provide an update for everybody. 

We’d like to say a HUGE thank you to Mike, Tim and Lisa Mather, who are all members of our wonderful community who have volunteered to do the massive bulk of the organisational work on this event for us for free – we’re a very small team and we simply couldn’t have managed this without them all. Thanks guys!

Hello everyone. Mike Horne and Tim Richardson here to update you on the Raspberry Pi Big Birthday Weekend.

What has been happening?

It has been quite a couple of weeks. On the 13th of January, we visited the University of Cambridge Computer Laboratory in the hope that it would act as the venue for the Raspberry Pi Big Birthday Weekend. We were incredibly impressed with the place and we would like to thank Professor Jon Crowcroft for making us feel so welcome and showing us around. It is a brilliant venue and we are very lucky to be able to hold it there.

University of Cambridge Computer Laboratory

Since that visit, it would be fair to say that we haven’t stopped! We opened up booking on the 14th January and since then we have sold over 1000 tickets across the two days and the party. The party sold out first, closely followed by the Saturday day event. There are still tickets available for the Sunday, and we are now running a waiting list for the Saturday. If you’d like to join us on the Sunday or join the waiting list, please register.

What will be happening at the Big Birthday Weekend?

Each person who has registered has been asked how they would like to be involved with the weekend, and we have been absolutely inundated with offers of talks, requests to join discussion panels, offers to help run workshops and to take part in show and tell. Mike has been collating all these different offers and requests and the timetables are now being worked on with Liz and the team at the Raspberry Pi Foundation. We hope to be able to release a firm programme within the next week after we’ve contacted everyone involved again. What we can say so far is the following:

  • We will have two lecture theatres and two workshop rooms.
  • Talks include: Andy Proctor, talking about his Raspberry Pi-enabled truck; Jonathan Pallant from Cambridge Consultants talking
    about their penguin and rhino monitoring stations; and a healthy education element (we’ve had loads of offers of education talks). There will be LOTS more – we’re just trying to sort through everything now!
  • Panels will include: a group of youngsters talking about how the Raspberry Pi has changed their lives; advice on running crowdfunding campaigns; a Foundation Education Team panel; a technical panel including Raspberry Pi engineers; and Q&As with all the people you know from the Foundation from social media and this blog.
  • Workshops will include: an introduction to integrating the Pi with electronics; a session for beginner Pi users which will  help them get set up; basic Minecraft programming skills; advanced Minecraft hacking with GPIO interfacing; a Scratch hackathon.

Party time!

On the Saturday evening there is, of course, a birthday party. We have had to limit this to 275 people, due to catering arrangements. Logistics for the party are being spearheaded by Lisa Mather and Tim. Lisa has been an absolute star for agreeing to help with the party, especially as she’s way up in Manchester. From there, she has been organising goodie bags and decorations and generally being brilliant, coming up with ideas to make the Lab look welcoming and exciting, as well as lending her party planning experience to help us not to miss anything! Tim and Lisa are also working out what Pi-powered party games we will be having, as well as organising Pi-powered music for the occasion.

Marketplace

Tim has also been organising the Marketplace for the event. The Marketplace will feature many well-known names in the Pi community including The Pi Hut, PiBorg, 4Tronix, Pimoroni and also a newcomer to the Pi arena: IQaudio who specialise in GPIO audio boards. We are hoping that there will be another couple of vendors joining us, but they need to confirm with us.

Robots!

We’re inviting anyone who has their own Raspberry Pi-based robot to bring it along to show it off. At Pi Wars we had a highly popular obstacle course. This course will be making an appearance at the Birthday Weekend (after Tim has carefully put it all back together again!) and you are invited to bring your own robot to try it out!

Picture from  www.pi-tutorials.co.uk

Picture from www.pi-tutorials.co.uk

Further information

One of the other things we have been working on with the Foundation team is an information page for the event. On this page you will find information on the venue, parking and where to stay in Cambridge if you require accommodation. We hope you’ll find the information there useful. If you have any questions about the event, please mail mike.horne@raspberrypi.org and we’ll attempt to answer them as best we can and then add that information, if appropriate, to the information page.

That’s it for now – we are aiming to keep you up-to-date with what has been happening every week, so don’t forget to keep on checking back!

Education, space, hacking and explosions – Bett 2015

via Raspberry Pi

Last Tuesday the Raspberry Pi education team beetled down to the ExCeL London for Bett, the gargantuan learning technology event. We spent the next four days on our new and fabulous stand talking, educating, demo-ing, entertaining, showboating, dancing and gerrymandering. There were astounding demonstrations of technological ingenuity, feats of strength and curious electro-mechanical devices.

Ready for action: the education team plus James Robinson (leftest), Martin O'Hanlon (bluest) and Sam Aaron (tallest).

Ready for action: the education team plus James Robinson (leftest), Martin O’Hanlon (bluest) and Sam Aaron (tallest). Clive is weeping openly but laughing inside.

We were happily overrun by what seemed like most of the Raspberry Pi community, many of whom made guest appearances in our back to back schedule. We ran hands-on-workshops in Minecraft Pi, Sonic Pi, physical computing, games programming and much more. We stormed the BETT arena with Astro Pi and Fran Scott’s pyro-computing show. We ran about and hooted. It was a brilliant show. My post-show brain is far too fried to write so here are some of our favourite bits:

Carrie Anne kicks off the show with who the Raspberry Pi Foundation are and what we do

Carrie Anne kicks off the show with who the Raspberry Pi Foundation are and what we do

Set-up day. Dave says this is the only place he could get electricity.

Set-up day. Dave claims that this is the only place he could get electricity.

I am not a number, I am a free man.

I am not a number, I am a free man.

James about to send up a time-lapse Pi on a helium balloon to spy on other stands.

James about to send up a time-lapse Pi on a helium balloon to spy on other stands.

Laura Dixon's (@codeboom) students from the Royal High School Bath talking about  Minecraft coding and their computing club

Laura Dixon’s (@codeboom) students from the Royal High School Bath talking about Minecraft coding and their computing club

Dr Sam Aaron, creator of Sonic Pi, showing people how to create beautiful music with code

Dr Sam Aaron, creator of Sonic Pi, showing people how to create beautiful music with code

Stunned silence then cheering: a blackout at Bett. (Nothing to do with us, honest.)

Stunned silence then cheering: a blackout at Bett. (Nothing to do with us, honest.)

Dave Honess introducing Astro Pi and the ISS. His pitch-roll-yaw demo is now legend https://twitter.com/Raspberry_Pi/status/558960988096307200

Dave Honess introducing Astro Pi and the ISS. His pitch-roll-yaw demo is now legend

Lance Howarth and Astro Pi on Bett Arena

Lance Howarth and Astro Pi on Bett Arena

“My favourite moment was being rushed for Astro Pi leaflets at the end of the opening ceremony of the main arena. I have a great feeling about this whole thing” — Dave Honess

A first for Bett arena we think: Fran Scott exploding hydrogen -filled balloons in the Arena.

A first for Bett we think: Fran Scott exploding hydrogen-filled balloons in the Arena.

Of course it’s not so easy to blow up stuff in the classroom so we made a safe version, the Balloon Pi-tay Popper:

Fran demonstrating the explosive-free Balloon Pi-tay popper resource.

Fran demonstrating the explosive-free Balloon Pi-tay popper resource.

Connecting Minecraft Pi to the real world: @whaleygeek's Big Red Button of Doom!

Connecting Minecraft Pi to the real world: @whaleygeek’s Big Red Button of Doom!

Our friends from Pimoroni show of their brilliant Flotilla

Our friends from Pimoroni show off their brilliant Flotilla

Andrew Mullolland, a student at Queen's University Belfast, and his LTSP classroom management system for Raspberry Pi

Andrew Mulholland, a student at Queen’s University Belfast, and his LTSP classroom management system for Raspberry Pi

Stewards Academy student @jaymegisbourne demonstrating his Porta-Pi

Stewards Academy student @jaymegisbourne demonstrating his Porta-Pi

Raspberry Pi Certified Educators Cat Lamin and Tom Sale show how easy it is to use Pis in Primary Schools

Raspberry Pi Certified Educators Cat Lamin and Tom Sale show how easy it is to use Pis in primary schools

Carrie Anne picks up her Best Author Award for Adventures in Raspberry Pi...

Carrie Anne picks up her well-deserved Best Author award for Adventures in Raspberry Pi…

...and celebrates in style with David Whale (@whaleygeek)

…and then celebrates in style with David Whale (@whaleygeek)

And that was that. Four days of manic educational goodness.

Thanks to CPC for supporting us, we couldn’t have done it without them. We had a fabulous stand and a great team across the way to give hardware advice and support.

A huge thanks to everyone who gave talks and demos and who helped out on the stand including: Sam Aaron, Laura Dixon, Martin O Hanlon, Alasdair Davies, Dave Honess & UK Space, Eliot Williams, Paul Beech, Jon Williamson, Phil Howard, David Whale, Tim Mockford, Simon Belshaw, Lauren Hyams, Fran Scott, Mike Horne, Tim Richardson, Jamie Mann, Matthew Parry, Cat Lamin, Tom Sale, Wolfram, Stephen Norbury, Naturebytes, Samantha Lubbe, Barry Byford, Karl-Ludwig Butte, Robin Newman, Andrew Mulholland, Spencer Organ, Geraldine Wright, Stewards Academy Raspberry Pi Club, and Cefn Hoile. If I’ve missed anyone then sorry and please email me!

Lastly a big thank you to all of the teachers, students, parents, educators and anyone else who came to see us. See you again next year!

Thirty-five Pixels, powered by Raspberry Pi

via Raspberry Pi

Creative Director and Interactive Developer Michael Newman was tapped by UCLA Extension to design their 2015 winter course catalog cover. To accompany his work, he also designed, developed, and built a Raspberry Pi-powered interactive installation called Thirty-five Pixels which is currently on display at UCLA Extension’s 1010 Westwood building through the 2015 Winter Quarter.

[caption id=”attachment_11152″ align=”aligncenter” width%3

Flotilla

via Raspberry Pi

Liz: Here’s a guest post from our friend Paul at Pimoroni, who has a really exciting Kickstarter to share. You know Paul’s work already: he designed the Raspberry Pi logo, and he’s the brain behind the ridiculously successful Pibow case. Over to Paul!

When I was in nursery school, our class had a BBC Micro. One day, it was my turn to play. I’d been ‘painting’, and being young and uneducated, didn’t wash my hands before using the computer, and got paint smears all over this shiny beige machine.

I got shouted at by the teacher a lot and didn’t get to play. Protecting the shiny new machine was more important than learning.

This is why I love Raspberry Pi. It’s a computer you can be rough and experimental with. If it breaks, it’s replaceable, unlike an expensive iPad or laptop.

Learning is more important than the thing you’re learning on. But this attitude of fear and reticence still prevails. We still see a lot of doubt, and a “that’s not for me” feeling when it comes to tinkering and plugging things into circuit boards. As much as we love playing with breakout boards, and the geekery involved, the friction that goes with it can easily turn a 10 minute job into an hour. Digging out wires, reading datasheets, and finding three blog posts with different libraries in various states of undress; we think these are unnecessary distractions.

So, being Pimoroni, we had a lightbulb moment and decided to fix a bunch of issues at the same time. A year later, Flotilla was born; making all these frustrations a thing of the past.

Flotilla is a system of smart, affordable breakout boards backed by great software that lets you easily use them on the Raspberry Pi. The idea is that you can just break out a Pi, pop in a Raspbian SD card with the Flotilla software installed, plug in the Dock then start playing and learning without knowing much of anything beforehand.

widgets

The first level is Cookbook. You plug widgets into the Dock. Cookbook suggests recipes that involve those pieces. So plug in a Light-sensor, a Barometer, and Cookbook might suggest you build a weather station or a Digi-pet.

cookbook

The next step is Rockpool. A simple app-like interface for defining rules. So you can say “If the temperature is high, turn a motor with a fan on”. It’s impossible to get wrong, and can be used without typing. You can build surprisingly complex projects; such as line-following robots, musical devices and games.

rockpool

The Pi can also act as a WiFi Access point and web server. This lets you connect to Flotilla from your tablet, phone or laptop, and control Cookbook and Rockpool from a web-browser. Great if you’re running your Pi from a battery. On a robot, say. :-)

After that, you’re into the world of Scratch and Python. We’ll be providing lovely Flotilla libraries to get you started.

The whole idea is top-down learning. People start by having fun, and doing and discovering what interests them. If they like it, they can delve further into how things work. Clive says it best in the video. It’s “learning by stealth”.

We’re pretty sure Flotilla is the first fully-fledged plug-and-play digital tinkering kit. We’re also sure that the Raspberry Pi is the right place for it. The easier it is for everyone to start learning, and being comfortable with computers and electronics, the more time scientists and engineers have to make spaceships, instead of a better coffee-maker, or pet-feeder.

We’re on Kickstarter now, and would love you to support Flotilla so we can turn it into something everyone can use, in schools, at home, in the lab, and contribute too :D

http://flotil.la

- Paul & Jon & the Pirate Crew.

Resources Restyled

via Raspberry Pi

Back in April, when we launched a revamp of our whole website, we introduced a section of free learning resources. Recently we’ve been working on a new and improved design for the layout of this material, and we’re launching it today for a selection of our resources.

balloon-pi-tay-popper

The new look and feel of our free learning resources

Our new in-house designer Sam has produced the templates along with a brilliant set of icons, components, characters, illustrations and bespoke GPIO and wiring diagrams.

The Learn and Make activities are:

We have also revamped a number of Teach resources, each containing lesson plans and links to the Programme of Study:

As well as a new guide to for teachers:

We think they’re looking great – and hope you all do too!

Pi-tay_Popper_TILE Getting_Started_With_Minecraft_Tile PARENT_DETECTOR_TILE ROBOT_ANTENNA_TILE INFRARED_BIRD_BOX_TILE Sonic_Pi_Lessons_Tile Push_Button_Stop_Motion_Tile GETTING_STARTED_LESSON_PLAN_TILE GPIO_Music_Box_TILE MAKE_A_SPINNING_FLOWER_TILE SORTING_HAT_TILE TEACHERS_CLASSROOM_GUIDE_TILE

We’ll be migrating all of our resources into the new template in the coming weeks. The content still all lives on GitHub, and you can still collaborate; if you’re a regular contributor, you’ll notice that there are some extra files to make the templates work.

New recipe cards for our learning resources

Gotta collect ‘em all!

 

Remember all our resources are available for free under a Creative Commons licence, so you can print, copy, share, modify and do anything you want with the materials – we don’t want to restrict educators in any way! We know some of our Raspberry Pi Certified Educators from Picademy have been using their own modified versions of our worksheets to teach the Computing curriculum – it’s a great way of tailoring the material to the needs of their own students.

Those of you who are coming to see us at BETT this week will see we’ve also been giving out recipe cards for each of these new style resources, which again have been beautifully designed by Sam. Teachers – if you miss us at BETT, you can download these recipe cards to print out for your wall displays.

Carrie Anne leading the first session of the day at BETT

The education team out in force at BETT

Check out the rest of our teach, learn and make resources look through our BETT schedule on our website.

Social animals: electric eel tweets with a Pi

via Raspberry Pi

Meet Miguel Wattson (geddit?), the most piscine member of the Raspberry Pi community. Miguel is an electric eel who lives in a tank at Chattanooga Zoo; and his keepers, with some help from some computer science interns, have decided to use Miguel’s tendency to generate electricity to do some showboating.

miguelwattson

Bzzzzt.

 

Electric eels (actually a kind of knifefish, so strictly speaking they’re electric fish, which sounds much less cool) have the ability to discharge up to 860 volts from three large organs made from electrocytes – organic cells which work like the voltaic pile in an early battery –  which they use to stun prey, to communicate, and to navigate. An electric eel at full power only discharges for a couple of milliseconds, but even so, has the ability to electrocute a full-sized human.

This is all very glamorous and exciting, but the problem for eel watchers is that all of this drama is silent and invisible. There’s no way to tell just from watching whether or not an electric eel is discharging. Happily, there’s a way around that.

Sensors (I’m guessing electrodes in the water, connected to ground, whose resistance can be measured – but I do not have an electric eel to test this setup on – your ideas in the comments please!) in Miguel’s tank detect when he discharges. These signals are sent to a LED light and speaker system in the aquarium, where they make static rapping sounds, and flash lights to demonstrate how frequently Miguel discharges. Here he is, doing his thing at feeding time.

But the aquarium team didn’t stop there. Miguel’s electrical activity also sends a message to the attached Raspberry Pi, telling it to send a tweet. Miguel’s Twitter feed is full of fishy puns, eel facts, and messages about conservation – along with the occasional “POW” and “BUZZ!” A database of tweets is constantly added to by staff at the aquarium (Miguel does not have fingers and consequently finds it hard to type)

“Ironically, the eel code was written in Python,” said Evgeny Vasilyev, one of the computer science interns  from Tennessee Technological University’s Business Media Center. “The project’s main set piece was Raspberry Pi, a low cost computer which provides all of the necessary functionality in a compact package.”

The Pi not only sends the tweets – it acts as a throttle to make sure that Miguel doesn’t start spamming the feed when he gets overexcited. Feeding time, for example, gets Miguel so overstimulated that he discharges more than once a second. The Pi keeps the frequency of tweets down to a reasonable level.

The Chattanooga Times Free Press has some video of the setup:

You can follow Miguel on Twitter at @EelectricMiguel. You’ll notice that he follows Tennessee Aquarium’s pioneering tweeting groundhog (no, we have no idea what a groundhog is doing in an aquarium), @ChattNoogaChuck, whose profile boasts that he is the aquarium’s chief seasonal forecaster.

If you’re following Miguel, keep an eye out on Mondays, Wednesdays and Fridays, when he’s fed, for bursts of activity!

Fran Scott’s #Error404 show at BETT

via Raspberry Pi

It’s not long to BETT now where the Foundation education team will spend four whole earth days doing great works.

Fran Scott

As well as a non-stop stand schedule of talks, demos and activities we’ve also got a number of off-stand monkeyshines including two live stage shows by Fran Scott, who you may have seen recently on the Royal Institution Christmas lectures. Fran will be performing her show #Error404: The Explosions-based computing show and revealing “Computer Science for the problem-solving, creative and imaginative subject it innately is and through live interactive coding, humour and explosions(!)”. (That had me at “explosions” and I was reading the sentence backwards.)

fran scott

If the Foundation’s had a mantra it would be “computing is not coding”. It’s so much more than that, in fact in the early years of education it should just be called ‘Thought-provoking Fun’. Fran’s show is a brilliant practical demonstration of that and she has a talent for explaining science and engineering principles in an entertaining way that everyone can understand. As well as computing the show hooks into the science curriculum (gases and combustion) and also contains dancing and bananas. There’s loads crammed in and it’s a fantastic show—it’s going to be packed so get there early!

baloon popping cartoon

To tie in with the show we’ll be giving away goody bags containing everything you need to make your own (non-explosive!) version of Pi-controlled balloon popping which would make a fab classroom demo or even a great way to wake your parents up in the morning.

Where and when

The shows are on Thursday 22 Jan at 13:10 and Saturday 24 Jan at 12:55, both in the BETT Arena. Fran will also be on our stand (The Hub! near N8 visitors’ entrance) on Thursday afternoon between 16:00 and 17:00.

Find out more

You can read more about the show on Fran’s site and also download an information pack which includes links to the English Computing curriculum. You can also get in touch with Fran if you want to find out more about the show.

Warning: Blowing stuff up and messing around with pyrotechnics is dangerous so do not do it. Fran is a trained pyrotechnician and a member of the Association of Stage Pyrotechnicians. Do not blow stuff up or set light to stuff or play with matches or stick red Crayola crayons up your nose (as my brother once did). Bad things will happen.

WaterFall Spectrogram.

via coolarduino

Playing with my new toy (TFT ILI9486) I discovered, that its support vertical scrolling feature.  And my fft library needs a demo-video, so idea for new project was born. Waterfall spectrogram, real-time, audio 20 – 20 000 range. Main board is arduino DUE.  Plus capacitors and couple resistors to bias analog input at V / 2. Rectangular pulse from my DSO forms wide harmonics content, excellent source to demonstrate aliasing -);.

 

vsc_setup() sends 0x33 command to tft, setting vertical scroll area. and vScroll() 0x37 rotates image.

#include <SplitRadixReal.h>
#include <UTFT.h>

#define   SMP_RATE          44100UL 
#define   CLK_MAIN       84000000UL
#define   TMR_CNTR       CLK_MAIN / (2 *SMP_RATE)

// FFT_SIZE IS DEFINED in Header file Radix4.h 
// #define   FFT_SIZE           2048

#define   MIRROR         FFT_SIZE / 2
#define   INP_BUFF       FFT_SIZE 
         
volatile   uint16_t   sptr              =   0 ;
volatile    int16_t   flag              =   0 ;

           uint16_t  inp[2][INP_BUFF]   = { 0};     // DMA likes ping-pongs buffer

            int         f_r[FFT_SIZE]   = { 0};
            int         magn[MIRROR]    = { 0};     // Magnitudes
const       int         dc_offset       = 2047; 

            uint8_t          print_inp  =    0;     // print switch

            SplitRadixReal     radix;


#define     SIZE_X                          320
#define     SIZE_Y                          480
#define     BORDER                            5
#define     BFA                          BORDER  // Bottom Fixed Area
#define     TFA                      (SIZE_Y /2)  // Top Fixed Area 240
#define     VSH             (SIZE_Y - BFA - TFA) // Vertical Scroll Area 235
#define     CSEL                             40
#define     WFALL           (SIZE_X -(2* BORDER) -2)// Width-306
#define     MAPCF                             3  // Re-map coefficient, 1024 : 320

            UTFT        myGLCD( ILI9486, 38, 39, CSEL, 41);
extern      uint8_t     BigFont[];

            int         vsp                 = 0;

            int         imag[WFALL]      = { 0};     // Image-1
            int         blgo[WFALL]      = { 0};     // Image-2
            uint16_t    color_map[1024]  = { 0}; 
            uint16_t    log10_map[1024]  = { 0}; 

void setup()
{
  Serial.begin (115200) ; 
  adc_setup ();         
  tmr_setup ();         
//
  myGLCD.InitLCD(PORTRAIT);
  myGLCD.clrScr();

  vsc_setup();
  set_lake();  
  gen_cmap();  // color wheel map (LUT)
  gen_lmap();  // log-10 map (LUT)
  
  pinMode( 44, OUTPUT); // fft
  pinMode( 45, OUTPUT); // re-map
  pinMode( 46, OUTPUT); // pour_water
  pinMode( 47, OUTPUT); // belagio

  pinMode( 55, OUTPUT); // MIC Power
  digitalWrite( 55, HIGH);
}

inline int mult_shft12( int a, int b)  
{
  return (( a  *  b )  >> 12);      
}

void loop() 
{
  if ( flag )
  {   
   uint16_t indx_a = flag -1;
   uint16_t indx_b = 0;

digitalWrite( 44, HIGH);
   for ( uint16_t i = 0, k = (NWAVE / FFT_SIZE); i < FFT_SIZE; i++ ) 
   {  
      uint16_t windw = Hamming[i * k];
      f_r[i] = mult_shft12((inp[indx_a][indx_b++] - dc_offset), windw);
   }

   if( print_inp ){
     Serial.print("ntBuffer: ");    
     Serial.print(indx_a, DEC);       
     prnt_out2( f_r, FFT_SIZE);
     print_inp =  0;
     }

   radix.rev_bin( f_r, FFT_SIZE);
   radix.fft_split_radix_real( f_r, LOG2_FFT);
   radix.gain_Reset( f_r, LOG2_FFT -1); 
   radix.get_Magnit2( f_r, magn);

digitalWrite( 44,  LOW);
digitalWrite( 45, HIGH);

   re_map();
digitalWrite( 45,  LOW);
digitalWrite( 46, HIGH);

   pour_water();
digitalWrite( 46,  LOW);
digitalWrite( 47, HIGH);

   belagio();
digitalWrite( 47,  LOW);

   while (Serial.available()) {
        uint8_t input = Serial.read();
        switch(input) {
        case 'r':
            break;           
        case 'x':
            print_inp = 1;
            break;
        case 'f':
            Serial.print("ntReal: ");    
            prnt_out2( f_r, MIRROR);
            break;
        case 'o':
            Serial.print("ntMagnitudes: ");    
            prnt_out2( magn, MIRROR);
            break;
        case '?':
        case 'h':
            cmd_print_help();
            break;
        default: // -------------------------------
            Serial.print("Unexpected: ");
            Serial.print((char)input);
            cmd_print_help();
        }
    Serial.print("> ");
    }
   flag = 0;
   }   
}

void prnt_out2( int *array, int dlina) 
{
  Serial.print("nt");      
     for ( uint32_t i = 0; i < dlina; i++)
     {
       Serial.print(array[i]);       
       Serial.print("t");    
       if ((i+1)%16 == 0) Serial.print("nt");
     }
  Serial.println("nt");
}

void cmd_print_help(void) 
{
    Serial.println("n  Listing of all available CLI Commandsn");
    Serial.println("t"?" or "h": print this menu");
    Serial.println("t"x": print out adc array");
    Serial.println("t"f": print out fft array");
    Serial.println("t"o": print out magnitude array");
}

 

void vsc_setup(void)
{
  digitalWrite( CSEL, LOW);
  myGLCD.LCD_Write_COM( 0x33 );

  char BH0 = (TFA  >>   8);
  char BL0 = (TFA  & 0xFF);
  myGLCD.LCD_Write_DATA( BH0);
  myGLCD.LCD_Write_DATA( BL0);

  char BH1 = (VSH  >>   8);
  char BL1 = (VSH  & 0xFF);
  myGLCD.LCD_Write_DATA( BH1);
  myGLCD.LCD_Write_DATA( BL1);

  char BH2 = (BFA  >>   8);
  char BL2 = (BFA  & 0xFF);
  myGLCD.LCD_Write_DATA( BH2);
  myGLCD.LCD_Write_DATA( BL2);

  digitalWrite( CSEL, HIGH);
}

void set_lake(void)
{
  myGLCD.setFont(BigFont);
  myGLCD.setBackColor( 255, 255, 255);
  myGLCD.setColor(255, 255, 255);
//    myGLCD.setColor( 150, 255, 255);
  int dispx = SIZE_X - 1;
  int dispy = SIZE_Y - 1;

  myGLCD.fillRect( 0, 0, dispx, dispy);
  
  myGLCD.setColor(   0,   0, 255);
  int x1 = BORDER -2;
  int x2 = SIZE_X - x1;//BORDER -2;
  int y1 = BORDER -2;
  int y2 = SIZE_Y - y1;//BORDER -2;
//  myGLCD.drawRect(x1, y1, x2, y2); 
  myGLCD.fillRect(    0,   0,    x1, dispy); // left
  myGLCD.fillRect(   x2,   0, dispx, dispy); // right
  myGLCD.fillRect(    0,   0, dispx,    y1); // top
  myGLCD.fillRect(    0,  y2, dispx, dispy); // bot
//
  int strip = VSH / 2;
  myGLCD.setColor( 255,   0, 255);
  myGLCD.fillRect(  0, (y2 -2),    x1, (y2 -2 -strip)); 
  myGLCD.fillRect( x2, (y2 -2), dispx, (y2 -2 -strip));  
// riski
  myGLCD.setColor( 0, 255, 255);

  myGLCD.drawRect( x1, 50, x2, 53);    // Draw a Scale

  for ( int i = x2, cont = 0; i > x1; i -= 15, cont++ ) {
  
    myGLCD.drawRect( i, 50, i+2, 45);
    if(((cont %5) ==0) && (cont != 0)) {
      myGLCD.fillRect( i, 50, i+2, 40);
    }
  }
  myGLCD.print("0   5   10   15   20", x2, 30, 180);
}


void pour_water(void)
{
  int y = vsp + TFA;      //y = bottom line of scroll area 
  myGLCD.vScroll( y );    //roll frame.

  int x = SIZE_X - BORDER;
  for( int i = 0; i <  WFALL; i++, x--) { 
      int temp = imag[i];
      myGLCD.setColor( temp ); 
      myGLCD.drawPixel( x, y );
    }
  if(++vsp >= VSH) vsp = 1;
}

void belagio(void)
{
  int st_x = SIZE_X - BORDER; 
  int st_y = BORDER + 50; //dlya risok

// 20 ms
  myGLCD.setColor( 255, 255, 255);
  myGLCD.fillRect( st_x, st_y, st_x - WFALL, VSH);
  //  myGLCD.setColor(VGA_SILVER);

  myGLCD.setColor(  0,  0, 255);

  for( int i = 0; i <  WFALL; i++, st_x--) { 
      int temp = ((blgo[i] * 3)/ 4); // kompensate 255 : 185 (235-50)
      int end_y = st_y + temp;
      
      if(end_y > VSH) end_y = VSH; 
      
      if(temp > 0) myGLCD.drawLine( st_x, st_y, st_x, end_y );
    }
}

 

void re_map(void)
{
  for( int i = 0; i <  WFALL; i++) {
    imag[i] = 0; 
    }
 
  for( int j = 1; j < MIRROR; j++) { // DC off
    int indx = j / MAPCF;
       if( indx >= WFALL ) break; 
       imag[indx] += magn[j]; 
     }

  for( int i = 0; i <  WFALL; i++) { 
     int temp = imag[i];
       if( temp > 1023 ) temp = 1023;       
       temp = log10_map[temp];

       blgo[i] = (temp >> 2);
       imag[i] = color_map[temp];
     }
}


uint16_t setnColor( int layer ) {
    int  center = 128; // DC offset
    int  width 	= 127; // Amplitude  	    

    float frequency = (float) (0.001 * 2 * M_PI * layer); //0.0014 -bardovui

    float phi090 = (float) (M_PI * 1 /2 ); // 4/3=240
    float phi240 = (float) (M_PI * 4 /3 ); // 4/3=240
    float phi360 = (float) (M_PI * 2 /1 ); // 4/3=240

      int red = (int) (sin(frequency + phi360) * width + center);
      int grn = (int) (sin(frequency + phi090) * width + center);
      int blu = (int) (sin(frequency + phi240) * width + center);
        
    //  uint16_t color = yrk << 24 | red << 16 | grn << 8 | blu;
    uint16_t  color = ((red & 248) << 8 | (grn & 252) << 3 | (blu & 248) >> 3);

  return color;
}

void gen_cmap(void) 
{
  for( int bc = 0; bc < 1024; bc++) { color_map[bc] = setnColor( bc ); }	
}

void gen_lmap(void) 
{
  for( int bc = 0; bc < 1024; bc++) {
     log10_map[bc] = (int)((373.0 * log10(bc + 1.0)) - 100.0);
   }
  log10_map[0] = 0; 	
}


 

void tmr_setup ()
{
  pmc_enable_periph_clk(TC_INTERFACE_ID + 0 *3 + 0); // clock the TC0 channel 0

  TcChannel * t = &(TC0->TC_CHANNEL)[0] ;            // pointer to TC0 registers for its channel 0
  t->TC_CCR = TC_CCR_CLKDIS ;                        // disable internal clocking while setup regs
  t->TC_IDR = 0xFFFFFFFF ;                           // disable interrupts
  t->TC_SR ;                                         // read int status reg to clear pending
  t->TC_CMR = TC_CMR_TCCLKS_TIMER_CLOCK1 |           // use TCLK1 (prescale by 2, = 42MHz)
              TC_CMR_WAVE |                          // waveform mode
              TC_CMR_WAVSEL_UP_RC |                  // count-up PWM using RC as threshold
              TC_CMR_EEVT_XC0 |     // Set external events from XC0 (this setup TIOB as output)
              TC_CMR_ACPA_CLEAR | TC_CMR_ACPC_CLEAR |
              TC_CMR_BCPB_CLEAR | TC_CMR_BCPC_CLEAR ;
  
  t->TC_RC = TMR_CNTR;              // counter resets on RC, so sets period in terms of 42MHz clock
  t->TC_RA = TMR_CNTR /2;           // roughly square wave
  t->TC_CMR = (t->TC_CMR & 0xFFF0FFFF) | TC_CMR_ACPA_CLEAR | TC_CMR_ACPC_SET ;  // set clear and set from RA and RC compares
  t->TC_CCR = TC_CCR_CLKEN | TC_CCR_SWTRG ;  // re-enable local clocking and switch to hardware trigger source.  
}

void adc_setup ()
{
  pmc_enable_periph_clk(ID_ADC);
  adc_init(ADC, SystemCoreClock, ADC_FREQ_MAX, ADC_STARTUP_FAST);
  NVIC_EnableIRQ (ADC_IRQn);               // enable ADC interrupt vector

  adc_disable_all_channel(ADC);
  adc_enable_interrupt(ADC, ADC_IER_RXBUFF);

  ADC->ADC_RPR  =  (uint32_t)  inp[0];      // DMA buffer
  ADC->ADC_RCR  =  INP_BUFF;
  ADC->ADC_RNPR =  (uint32_t)  inp[1];      // next DMA buffer
  ADC->ADC_RNCR =  INP_BUFF;
  ADC->ADC_PTCR =  1;

  adc_set_bias_current(ADC, 0x01); 
  //  adc_enable_tag(ADC);
  adc_enable_channel(ADC, ADC_CHANNEL_7);  // AN0
  adc_configure_trigger(ADC, ADC_TRIG_TIO_CH_0, 0);
  adc_start(ADC); 
}

void ADC_Handler (void)
{
  if((adc_get_status(ADC) & ADC_ISR_RXBUFF) ==	ADC_ISR_RXBUFF) {
    flag = ++sptr; 
    sptr &=  0x01;
    ADC->ADC_RNPR  =  (uint32_t)  inp[sptr];
    ADC->ADC_RNCR  =  INP_BUFF;
    }
}

And last touch, you need to add this function, inside UTFT or in main sketch:


void UTFT::vScroll( int vsp )
{
cbi(P_CS, B_CS);
LCD_Write_COM( 0x37 );

char BH0 = ( vsp >> 8);
char BL0 = ( vsp & 0xFF);
// LCD_Write_DATA( BH0, BL0);
LCD_Write_DATA( BH0);
LCD_Write_DATA( BL0);
sbi(P_CS, B_CS);
}

 



VNC tutorial from 10-year-old Philip

via Raspberry Pi

Philip Organ is a regular attendee at the Cambridge Raspberry Jams. He’s ten now; we first met him back when he was seven, when he sent us a video of a game he’d written for his Pi.

Philip (small) with me and Eben (large) at the last Raspberry Jam

Philip (small) with me and Eben (large) at the last Raspberry Jam

Philip’s Pi shenanigans were impressive then, but he’s come on leaps and bounds in three years. Here’s his most recent video: a tutorial on setting up a VNC server on your Raspberry Pi so you can access it remotely.

I wish more tutorials were like this. Thanks Philip!

 

Raspberry Pi Big Birthday Weekend 28 Feb – 1 March 2015

via Raspberry Pi

Raspberry Pi turns three (three!) next month and we would love you to come to our birthday party!

lego invite

The party is so huge and packed full of stuff that we couldn’t fit it into one day so we’ll be taking over the University of Cambridge Computer Laboratory on Saturday 28th February and Sunday 1st March for the Raspberry Pi Big Birthday Weekend. It’s going to be a buzzing behemoth benchmark of a birthday bash. Blimey!

There will be captivating talks, animated hands-on workshops, informative show and tell sessions and chatty panel discussions. There will be a marketplace to buy the latest Raspberry Pi add-ons and other cool stuff. There will be competitions, prizes and goodies galore and a chance to chat with the Raspberry Pi team over a nice cup of tea. There will be gardens bright with sinuous rills and little, fez-wearing monkeys riding unicycles. You really don’t want to miss it.

uncle buck pancakes

This is *exactly* what it will be like. But with fewer pancakes.

Each day will be different so feel free to come to both. As well as two days of all things Pi there will be an actual fill-yer-cakehole party from 4.30pm to 7.30pm on Saturday evening with food and drink (including a surprise birthday beverage).

So whether you’re a seasoned Pi person, whether you got a Pi for Christmas and would like to learn more or whether you’re just wondering what it’s all about then come along—we’d love to meet you. The Raspberry Pi Big Birthday Weekend is going to be a joyous celebration of creativity, technology and community so get your tickets now! Tickets are a scandalously reasonable £2.50 and entry is free for under 16s.

Get involved!

The party will be a celebration of all things Raspberry Pi which of course includes the amazing Raspberry Pi community. We’d like you to get involved and we are looking for people to:

  • give talks about Pi-related stuff;
  • run workshops or help run one;
  • take part in show-and-tell especially if you have interactive stuff or crazy inventions;
  • help run the day by spending a couple of hours as a marshal.

If you’d like to do any of these things (or have any other suggestions) then please get in touch. And if you’ve not done anything like this before then this is the perfect opportunity to help out, delight and inform us or just show off :) The party is being organised for us by Tim Richardson and Michael Horne—who are responsible for the excellent CamJams—so drop them a line and get involved!

We’ll also be running the Pi Wars obstacle course as first seen in the December CamJam so bring your robot along if you think it’s hard enough.

We’ll have a birthday webpage up shortly where we will post updated details of speakers, workshops and activities. If you don’t want to register yet but would like to be kept informed then sign up for the mailing list.

See you there!

 

Hacking the haulage industry

via Raspberry Pi

Regular readers will remember that we featured Andy Proctor’s delivery lorry – hacked with a Raspberry Pi to become an Internet of Things delivery Andy lorry – back at the start of December.  The BBC found out about him too, and he’s featuring on the front page of their news site today, with a really nice little video segment about what he’s been doing. Here it is for your viewing pleasure. Thanks Andy!

Machine learning, combustion engines and real-time control

via Raspberry Pi

What you’re about to watch in the video below is a magnificently physical example of machine learning. Adam Vaughan is controlling an engine with an adaptive Extreme Learning Machine algorithm on his Pi, which predicts homogeneous charge compression ignition (HCCI – if you’re  a petrolhead, you won’t have to look that up on Wikipedia like I did to discover that it’s a spark-free way of combusting fuel by putting it under pressure until it goes bang) in real time.

spaghetti

HCCI combustion is hard to predict – it’s near-chaotic – so the algorithm Adam designed has to take a huge number of samples (240,000 per second) to get enough data to learn how the engine behaves and to provide something so close to real-time control that you’d never know the difference. (It’s incredibly close to real time – there’s about 300 microseconds – that’s microseconds, or one millionth of a second; not milliseconds, which are a thousandth of a second – of latency here.)

The Pi is recording data about pressure in each of the engine’s cylinders, about the angle of the crank and about heat release – and on the back of that, it’s subsequently controlling the engine in real time over a controller area network (CAN).

This isn’t just a demonstration of how to do mind-bogglingly clever stuff. The research means that fuel efficiency can be improved, and CO2 can be reduced. If you’re interested in a more in-depth look, Adam and Stanislav Bohac have written a paper on the algorithm that’s being used in the video – go and read it if you want a maths and engineering workout!