The earliest gymnasiums date back over 3,000 years to ancient Persia. Indoor gymnasiums were first developed in Germany in the 19th century based on outdoor exercise spaces. The first gym in Spain opened in 1859 in Madrid and used basic machines made of iron and wood. Modern gyms are innovating, such as magnetic dumbbells that allow adjustable weight through electromagnets and outdoor gyms that generate electricity from exercise to charge devices.