I want to generate a 3V from the Raspberry Pi's 5V. Can I do that ?
Since there is already a 3.3V rail on the Pi itself, why not use that directly? If your circuit requires 3V not 3.3V (I doubt it would fry because of the extra 0.3V in the first place) you can drop it down with a Schottky diode like the boxes-of-thousand-per-few-bucks jellybean part
1N5819. Just keep in mind the 3.3V there have a maximum current draw limit of 50mA.
If you really need to generate 3V from a 5V rail, for instance you need to draw a bit more current than the built-in 3.3V rail can supply, you can use an low drop-out linear regulator. There are ready-made 3.3V and 2.85V ones (
AMS1117-2.85) or you can use an adjustable regulator chip to build your own (
AMS1117-ADJ) with two resistors (or a trimpot if you really want to trim it)
If you want even more current, you may want to use a switch-mode power supply (ready-made chips available too) for its better efficiency.
If you are so into rolling your own power supply module, building a switcher is actually simpler than building a LDO. A simple switcher (listing surface-mount parts here since I cannot find a good through-hole logic-level PMOS) built from an
ATtiny85 8-pin MCU, an
IRF7404 logic-level power MOSFET (or the cheaper
PMV48XP), a power inductor, an
SS14 Schottky diode (surface mount version of
1N5819) and a capacitor can be easier to debug than a homebrew LDO, and it is a lot more efficient if you can crank the switching frequency up (about 60MHz max in fact)
74HC245. Or its smaller siblings
74LVC2T45.Those chips can be more expensive than a resistive divider but it is a lot more reliable.
tl;dr: It's pin 1 on the GPIO pins. You can also use diodes to drop the voltage.
A shortcut: The pi already has a 3v pin. It's on pin 1 on the GPIO. Max current is 50ma.
Short answer: Yes, with a few components.
Long answer: Well, you can use a voltage divider or a logic level converter for different voltage communications. If you have a continuous load (maybe a fan or something) and you're feeling cheap, you can use diodes to drop the voltage.
For example, suppose you have some 1N4004 diodes. According to its datasheet, it has a max voltage drop of 0.8v, but it's usually around 0.7v. Using three of those in series would drop the voltage to about 2.9v (5v - 0.7v - 0.7v - 0.7v = 2.9v)
Also take note of the current limits. The pi can only handle so much current. The diodes would top off at 1A. A step-down voltage regulator would do the job better.