element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Blog Internet Controlled Whoopee Cushion
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
GPIO Pinout
Raspberry Pi Wishlist
Comparison Chart
Quiz
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: oneleggedredcow
  • Date Created: 10 Oct 2013 4:04 AM Date Created
  • Views 519 views
  • Likes 0 likes
  • Comments 0 comments
Related
Recommended
  • raspberry
  • raspi
  • pi
  • raspberry_pi
  • raspberrypi
  • rpi

Internet Controlled Whoopee Cushion

oneleggedredcow
oneleggedredcow
10 Oct 2013

Let’s have a little fun. Let’s turn a raspberry pi into an Internet controlled whoopee cushion.

image

So, the idea is pretty simple.  We run a server program on the raspberry pi.  This program will respond to commands that we send it.  In this case, we only need one command: fart.  Then we hide the raspberry pi next to a family member, friend, coworker, etc. and tell the raspberry pi to fart.  Hilarious every time.

Steps

1) Download the attached code.  There should be two files FartMachineServer.cpp and FartMachineClient.cpp.

 

wget http://www.element14.com/community/servlet/JiveServlet/download/38-119332/FartMachine.zip

unzip FartMachine.zip

 

2) The above code uses the Boost C++ libraries.  So, download and install them:

 

sudo apt-get install libboost-all-dev

 

3) Download your favorite fart sound.  The one that I used (fart-01.wav) can be found here:

 

wget http://www.soundjay.com/human/fart-01.wav

 

4) Compile the server:

 

g++ -lboost_system -lboost_thread FartMachineServer.cpp -o FartMachineServer.exe

 

5) Compile the client.  This should be done on the machine that you want to issue the fart command. (Remember to install boost on this machine, if it is not already installed):

 

g++ -lboost_system FartMachineClient.cpp -o FartMachineClient.exe

 

6) Get the IP address (inet addr) of the raspberry pi:

 

ifconfig

 

The IP address will typically be something like 192.168.XXX.XXX.  (Mine is 192.168.1.100)  This IP address will work if you are on the same local network.  If you are outside of the local network, you will need to set up port forwarding.

 

7) Pick your favorite port (mine is 1554) and start the server on the raspberry pi:

 

./FartMachineServer.exe 1554

 

8) Run the client code, passing it in the IP address from step 6) and the port number from step 7):

 

./FartMachineClient.exe 192.168.1.100 1554

 

9) Listen to beautiful flatulence and laugh.

Troubleshooting

1) The code is expecting the name of the audio file to be fart-01.wav and reside in the same directory as FartMachineServer.exe.  If this is not the case, they you will have to change the source code to point it to the correct location and recompile (step 4).

 

2) Verify that the sound works on your raspberry pi.  The following article gives a very detailed explanation of how to do that:

 

http://www.raspberrypi-spy.co.uk/2013/06/raspberry-pi-command-line-audio/

More Information

The code is based on the Boost blocking TCP example, which can be found here:

 

http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/examples/cpp03_examples.html

Attachments:
FartMachine.zip
  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube