While I haven’t done this with a class yet, I have tried it with my 10 year old son. Create a scavenger hunt with cryptic clues. Attach these clues to QR codes and put these at various places around the school or neighbourhood. These locations could be marked on a physical map or pinned on a Google Map. Students find the QR codes to decode the message and get their clues.
So that students have more involvement in the process of encoding, they could be given responsibility for creating one of the clues, linking it to a QR code and printing it out.