Code-cracking workshops are being run by the government's top secret GCHQ intelligence centre at a science festival in Cheltenham.
The aim is to encourage schoolchildren to consider how science and technology can be applied in the real world.
The challenges include building a mechanical or electrical device to transmit and receive messages.
A Morse code simulator is also being demonstrated to show how traditional communication remains relevant.
A spokesman for GCHQ said: "Numbers choosing to study STEM (science, technology, engineering and maths) subjects at school and university are reducing and at GCHQ we're keen to help change this.
"We want to stimulate the curiosity of young people, helping them understand how science, technology engineering and maths can affect their lives on a daily basis and also offer the opportunity for stimulating and successful careers."
Jessica Freeman, 11, from The Downs, Malvern College Prep School said: "It's much more fun that I thought it would be - Morse code is challenging but it's really fun."